master
1<Window x:Class="MVPtoMVVM.mvvm.MainWindow"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="MainWindow" Height="350" Width="525">
5 <DockPanel LastChildFill="False">
6 <DockPanel.Resources>
7 <Style x:Key="ValidationStyle" TargetType="Control">
8 <Style.Triggers>
9 <Trigger Property="Validation.HasError" Value="true">
10 <Setter Property="Control.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
11 <Setter Property="Control.BorderBrush" Value="Red" />
12 <Setter Property="Control.BorderThickness" Value="2" />
13 </Trigger>
14 </Style.Triggers>
15 </Style>
16 </DockPanel.Resources>
17 <ListView DockPanel.Dock="Top" ItemsSource="{Binding Path=TodoItems}">
18 <ListView.ItemTemplate>
19 <DataTemplate>
20 <StackPanel Orientation="Horizontal">
21 <Image Source="alert.png" Visibility="{Binding Path=ShowDueSoonAlert, Mode=OneWay}"/>
22 <TextBox Width="200" Text="{Binding Path=Description, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource ResourceKey=ValidationStyle}" />
23 <DatePicker SelectedDate="{Binding Path=DueDate, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource ResourceKey=ValidationStyle}" />
24 <Button Content="Save" Command="{Binding Path=SaveCommand}"></Button>
25 <Button Content="Del" Command="{Binding Path=DeleteCommand}"></Button>
26 </StackPanel>
27 </DataTemplate>
28 </ListView.ItemTemplate>
29 </ListView>
30 <DockPanel DockPanel.Dock="Bottom" LastChildFill="False">
31 <Button Content="Cancel Changes" DockPanel.Dock="Right" Command="{Binding Path=CancelChangesCommand}"/>
32 <Button Content="Add New Item" DockPanel.Dock="Right" Command="{Binding Path=AddNewItemCommand}"/>
33 </DockPanel>
34 </DockPanel>
35</Window>