-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
70 lines (68 loc) · 4.01 KB
/
Copy pathMainWindow.xaml
File metadata and controls
70 lines (68 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<Window x:Class="ObservableMvvm.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:ObservableMvvm"
mc:Ignorable="d"
Title="Santa's Naughty-or-Nice Blogger List" Height="450" Width="800">
<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<CheckBox Grid.Row="0" IsChecked="{Binding UseUpdateItemsExtension}" Content="Use Update Items Extension" />
<ItemsControl Grid.Row="1" ItemsSource="{Binding SantasBloggers}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="5" Padding="5" BorderThickness="2">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding NaughtyNiceRating}" Value="{x:Static local:NaughtyOrNice.Nice}">
<DataTrigger.Setters>
<Setter Property="Background" Value="Green" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding NaughtyNiceRating}" Value="{x:Static local:NaughtyOrNice.Naughty}">
<DataTrigger.Setters>
<Setter Property="Background" Value="OrangeRed" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding NaughtyNiceRating}" Value="{x:Static local:NaughtyOrNice.Coal}">
<DataTrigger.Setters>
<Setter Property="Background" Value="Black" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding JustAdded}" Value="True">
<DataTrigger.Setters>
<Setter Property="BorderBrush" Value="Black" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding JustAdded}" Value="False">
<DataTrigger.Setters>
<Setter Property="BorderBrush" Value="White" />
</DataTrigger.Setters>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel>
<Label Foreground="White" FontWeight="Bold" Content="{Binding Name}" HorizontalContentAlignment="Center"/>
<Label Foreground="White" FontWeight="Bold" Content="{Binding Blog}" HorizontalContentAlignment="Center"/>
<Label Foreground="White" FontWeight="Bold" Content="{Binding NaughtyNiceRating}" HorizontalContentAlignment="Center" />
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Window>