1
<Window x:Class="View.MainWindow"
2
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6
xmlns:view="clr-namespace:View"
7
xmlns:viewModel="clr-namespace:ViewModel;assembly=ViewModel"
8
xmlns:services="clr-namespace:ViewModel.Services;assembly=ViewModel"
9
xmlns:converters="clr-namespace:ValueConverters;assembly=ValueConverters"
11
Title="Notes" Height="450" Width="800" MinHeight="450" MinWidth="800">
13
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" IsInverted="False"/>
14
<DataTemplate x:Key="noteTemplate">
15
<StackPanel Margin="3" Orientation="Horizontal" HorizontalAlignment="Right">
16
<TextBlock Text="{Binding Title}"
17
Validation.ErrorTemplate="{x:Null}"
18
FontSize="12" Width="auto"
20
<Ellipse Width="5" Height="5" Fill="#FF9BBAC7" Margin="3"
21
Visibility="{Binding IsEdit,
22
Converter={StaticResource BoolToVisibilityConverter},
23
UpdateSourceTrigger=PropertyChanged}"/>
28
<viewModel:MainViewModel/>
31
<Grid.ColumnDefinitions>
32
<ColumnDefinition Width="175"
35
<ColumnDefinition Width="*"/>
36
</Grid.ColumnDefinitions>
38
Background="LightGray">
40
<RowDefinition Height="Auto"/>
41
<RowDefinition Height="*"/>
42
<RowDefinition Height="Auto"/>
43
</Grid.RowDefinitions>
44
<Grid Grid.Row="0" Margin="3" >
45
<Grid.ColumnDefinitions>
46
<ColumnDefinition Width="Auto"/>
47
<ColumnDefinition Width="*"/>
48
<ColumnDefinition Width="Auto"/>
49
</Grid.ColumnDefinitions>
50
<TextBlock Grid.Column="0"
53
HorizontalAlignment="Center" VerticalAlignment="Center"/>
54
<TextBox Grid.Column="1"
55
Background="LightGray"
57
Text="{Binding SearchNoteTitle, UpdateSourceTrigger=PropertyChanged,
59
VerticalAlignment="Center"/>
64
Background="LightGray"
66
ItemsSource="{Binding Notes,
67
UpdateSourceTrigger=PropertyChanged}"
68
SelectedItem="{Binding SelectedNote,
69
UpdateSourceTrigger=PropertyChanged}"
70
ItemTemplate="{StaticResource noteTemplate}"/>
74
<Grid.ColumnDefinitions>
77
</Grid.ColumnDefinitions>
78
<Button Grid.Column="0"
83
Command="{Binding AddNoteCommand}"/>
84
<Button Grid.Column="1"
89
Command="{Binding DeleteNoteCommand}"/>
95
<RowDefinition Height="Auto"/>
96
<RowDefinition Height="*" />
97
</Grid.RowDefinitions>
99
<TextBox FontSize="50"
101
Text="{Binding SelectedNote.Title, UpdateSourceTrigger=PropertyChanged}"
102
IsEnabled="{Binding IsEnabled}">
103
<TextBox.ContextMenu>
104
<ContextMenu Visibility="{Binding IsEdit,
105
Converter={StaticResource BoolToVisibilityConverter}, UpdateSourceTrigger=PropertyChanged}">
106
<MenuItem Header="Save" Command="{Binding SaveNoteCommand}"/>
108
</TextBox.ContextMenu>
112
Margin="0, 10, 0, 0">
114
VerticalScrollBarVisibility="Auto"
116
IsEnabled="{Binding IsEnabled}"
119
SpellCheck.IsEnabled="True"
120
services:RichTextBoxHelper.DocumentXaml="{Binding SelectedNote.Text,
121
UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
124
<RichTextBox.ContextMenu>
126
<MenuItem Header="Save" Command="{Binding SaveNoteCommand}"/>
128
</RichTextBox.ContextMenu>
132
<GridSplitter Grid.Column="0" Width="2" Background="White"/>