blob: 04ef733c027e968f926574bb6121447a7fba90f7 (
plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
<UserControl x:Class="MaterialDesignColors.WpfExample.Lists"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="clr-namespace:MaterialDesignColors.WpfExample.Domain"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="8" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}">ListBox</TextBlock>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<smtx:XamlDisplay Key="list_1" Grid.Column="0">
<ListBox IsEnabled="{Binding IsChecked, ElementName=EnableListBox}">
<TextBlock>Plain</TextBlock>
<TextBlock>Old</TextBlock>
<TextBlock>ListBox</TextBlock>
<TextBlock>Full of junk</TextBlock>
</ListBox>
</smtx:XamlDisplay>
<CheckBox Name="EnableListBox" Grid.Column="0" Grid.Row="1" IsChecked="True">Enabled</CheckBox>
<smtx:XamlDisplay Key="list_2" Grid.Column="1" Grid.Row="0">
<!-- piece together your own items control to create some nice stuff that will make everyone think you are cool. and rightly so, because you are cool. you might even be a hipster for all I know -->
<ItemsControl ItemsSource="{Binding Items1}"
Grid.IsSharedSizeScope="True"
Margin="12 0 12 0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type domain:SelectableViewModel}">
<Border x:Name="Border" Padding="8">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="Checkerz" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"/>
<StackPanel Margin="8 0 0 0" Grid.Column="1">
<TextBlock FontWeight="Bold" Text="{Binding Name}" />
<TextBlock Text="{Binding Description}" />
</StackPanel>
</Grid>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MaterialDesignSelection}" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</smtx:XamlDisplay>
<smtx:XamlDisplay Key="list_3" Grid.Column="2" Grid.Row="0">
<!-- and here's another -->
<ItemsControl ItemsSource="{Binding Items2}" Grid.IsSharedSizeScope="True">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type domain:SelectableViewModel}">
<Border x:Name="Border" Padding="8" BorderThickness="0 0 0 1" BorderBrush="{DynamicResource MaterialDesignDivider}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="Checkerz" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ToggleButton VerticalAlignment="Center" IsChecked="{Binding IsSelected}"
Style="{StaticResource MaterialDesignActionLightToggleButton}"
Content="{Binding Code}" />
<StackPanel Margin="8 0 0 0" Grid.Column="1">
<TextBlock FontWeight="Bold" Text="{Binding Name}" />
<TextBlock Text="{Binding Description}" />
</StackPanel>
</Grid>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MaterialDesignSelection}" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</smtx:XamlDisplay>
</Grid>
<TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Grid.Row="2" Margin="0 32 0 0">ListView</TextBlock>
<smtx:XamlDisplay Key="lists_4" Grid.Row="3">
<ListView>
<ListViewItem>
Hello
</ListViewItem>
<ListViewItem>
World
</ListViewItem>
<ListViewItem>
:)
</ListViewItem>
</ListView>
</smtx:XamlDisplay>
<TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Grid.Row="4" Margin="0 32 0 0">ListView.GridView</TextBlock>
<smtx:XamlDisplay Key="lists_5" Grid.Row="5">
<ListView ItemsSource="{Binding Items1}">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Code}" Header="Code" />
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="Name" />
<GridViewColumn DisplayMemberBinding="{Binding Description}" Header="Description" />
</GridView>
</ListView.View>
</ListView>
</smtx:XamlDisplay>
</Grid>
</UserControl>
|