我正在编写一个类似于OneNote,Evernote或Apple Notes的记事本应用程序-只是为了练习-我想制作一个ListBox来存储已保存笔记的列表。当用户单击项目(注释)时,文本将在RichTextBox中打开。
我一直在考虑使用.xml文件,该文件将存储注释的标题,创建注释的日期以及文件的本地化。 * .rtf文件(将是实际的便笺文件)需要保存在特定位置。如果在特定位置有任何保存的注释/文件,则需要更新ListBox。
这是我缩短的XAML代码:
Rscript
完整的XAML代码: https://pastebin.com/JbPq2HXT
这是我缩短的C#代码:
<Window x:Class="StudyNotes.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StudyNotes"
mc:Ignorable="d"
Title="StudyNotes" Height="450" Width="800" WindowStartupLocation="CenterScreen" Icon="app_icons/appicon2.ico">
<Window.CommandBindings>
<CommandBinding Command="ApplicationCommands.Save" Executed="Save_Executed" />
</Window.CommandBindings>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="225" MinWidth="180" MaxWidth="600"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="#FFDDEFFF" BorderBrush="#FFADBECD" BorderThickness="1" CornerRadius="3"/>
<ListBox Margin="10,86,10,10.5"/>
<Button x:Name="NewNoteButton" Margin="0,10,35,0" VerticalAlignment="Top" Height="23" HorizontalAlignment="Right" Width="20" BorderThickness="0" Background="Transparent" BorderBrush="Transparent" Focusable="False" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="NewNoteButton_Click">
<Image Source="/icons/page_add.png" Stretch="None"></Image>
</Button>
<Button x:Name="DeleteNoteButton" Margin="0,10,10,0" VerticalAlignment="Top" Height="23" HorizontalAlignment="Right" Width="20" BorderThickness="0" Background="Transparent" BorderBrush="Transparent" Focusable="False" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
<Image Source="/icons/page_delete.png" Stretch="None"></Image>
</Button>
</Grid>
完整的C#代码: https://pastebin.com/vKhJBAtd
要使ListBox在Apple Notes或Evernote之类的功能上相似,我需要做什么?