|
4 | 4 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
6 | 6 | xmlns:domain="clr-namespace:MaterialDesignColors.WpfExample.Domain"
|
| 7 | + xmlns:codeDisplayer="clr-namespace:CodeDisplayer;assembly=CodeDisplayer" |
7 | 8 | mc:Ignorable="d"
|
8 | 9 | d:DesignHeight="300" d:DesignWidth="300">
|
9 | 10 | <UserControl.Resources>
|
|
14 | 15 | </ResourceDictionary.MergedDictionaries>
|
15 | 16 | </ResourceDictionary>
|
16 | 17 | </UserControl.Resources>
|
17 |
| - <Grid Margin="8" > |
18 |
| - <Grid.RowDefinitions> |
19 |
| - <RowDefinition Height="Auto" /> |
20 |
| - <RowDefinition Height="Auto" /> |
21 |
| - <RowDefinition Height="Auto" /> |
22 |
| - <RowDefinition Height="Auto" /> |
23 |
| - <RowDefinition Height="Auto" /> |
24 |
| - <RowDefinition Height="Auto" /> |
25 |
| - </Grid.RowDefinitions> |
| 18 | + <codeDisplayer:XamlDisplayerPanel x:Name="XamlDisplayerPanel" Margin="8" > |
26 | 19 | <TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}">ListBox</TextBlock>
|
27 |
| - <Grid Grid.Row="1"> |
28 |
| - <Grid.RowDefinitions> |
29 |
| - <RowDefinition/> |
30 |
| - <RowDefinition Height="Auto"/> |
31 |
| - </Grid.RowDefinitions> |
32 |
| - <Grid.ColumnDefinitions> |
33 |
| - <ColumnDefinition Width="1*" /> |
34 |
| - <ColumnDefinition Width="1*" /> |
35 |
| - <ColumnDefinition Width="1*" /> |
36 |
| - </Grid.ColumnDefinitions> |
37 |
| - <ListBox Grid.Column="0" IsEnabled="{Binding IsChecked, ElementName=EnableListBox}"> |
38 |
| - <TextBlock>Plain</TextBlock> |
39 |
| - <TextBlock>Old</TextBlock> |
40 |
| - <TextBlock>ListBox</TextBlock> |
41 |
| - <TextBlock>Full of junk</TextBlock> |
42 |
| - </ListBox> |
43 |
| - <CheckBox Name="EnableListBox" Grid.Row="1" IsChecked="True">Enabled</CheckBox> |
44 |
| - <!-- 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 --> |
45 |
| - <ItemsControl Grid.Column="1" ItemsSource="{Binding Items1}" |
| 20 | + <ListBox IsEnabled="{Binding IsChecked, ElementName=EnableListBox}"> |
| 21 | + <TextBlock>Plain</TextBlock> |
| 22 | + <TextBlock>Old</TextBlock> |
| 23 | + <TextBlock>ListBox</TextBlock> |
| 24 | + <TextBlock>Full of junk</TextBlock> |
| 25 | + </ListBox> |
| 26 | + <CheckBox Name="EnableListBox" IsChecked="True">Enabled</CheckBox> |
| 27 | + <ItemsControl ItemsSource="{Binding Items1}" |
46 | 28 | Grid.IsSharedSizeScope="True"
|
47 | 29 | Margin="12 0 12 0">
|
48 |
| - <ItemsControl.ItemTemplate> |
49 |
| - <DataTemplate DataType="{x:Type domain:SelectableViewModel}"> |
50 |
| - <Border x:Name="Border" Padding="8"> |
51 |
| - <Grid> |
52 |
| - <Grid.ColumnDefinitions> |
53 |
| - <ColumnDefinition SharedSizeGroup="Checkerz" /> |
54 |
| - <ColumnDefinition /> |
55 |
| - </Grid.ColumnDefinitions> |
56 |
| - <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"/> |
57 |
| - <StackPanel Margin="8 0 0 0" Grid.Column="1"> |
58 |
| - <TextBlock FontWeight="Bold" Text="{Binding Name}" /> |
59 |
| - <TextBlock Text="{Binding Description}" /> |
60 |
| - </StackPanel> |
61 |
| - </Grid> |
62 |
| - </Border> |
63 |
| - <DataTemplate.Triggers> |
64 |
| - <DataTrigger Binding="{Binding IsSelected}" Value="True"> |
65 |
| - <Setter TargetName="Border" Property="Background" Value="{DynamicResource MaterialDesignSelection}" /> |
66 |
| - </DataTrigger> |
67 |
| - </DataTemplate.Triggers> |
68 |
| - </DataTemplate> |
69 |
| - </ItemsControl.ItemTemplate> |
70 |
| - </ItemsControl> |
71 |
| - <!-- and here's another --> |
72 |
| - <ItemsControl Grid.Column="2" ItemsSource="{Binding Items2}" |
| 30 | + <ItemsControl.ItemTemplate> |
| 31 | + <DataTemplate DataType="{x:Type domain:SelectableViewModel}"> |
| 32 | + <Border x:Name="Border" Padding="8"> |
| 33 | + <Grid> |
| 34 | + <Grid.ColumnDefinitions> |
| 35 | + <ColumnDefinition SharedSizeGroup="Checkerz" /> |
| 36 | + <ColumnDefinition /> |
| 37 | + </Grid.ColumnDefinitions> |
| 38 | + <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"/> |
| 39 | + <StackPanel Margin="8 0 0 0" Grid.Column="1"> |
| 40 | + <TextBlock FontWeight="Bold" Text="{Binding Name}" /> |
| 41 | + <TextBlock Text="{Binding Description}" /> |
| 42 | + </StackPanel> |
| 43 | + </Grid> |
| 44 | + </Border> |
| 45 | + <DataTemplate.Triggers> |
| 46 | + <DataTrigger Binding="{Binding IsSelected}" Value="True"> |
| 47 | + <Setter TargetName="Border" Property="Background" Value="{DynamicResource MaterialDesignSelection}" /> |
| 48 | + </DataTrigger> |
| 49 | + </DataTemplate.Triggers> |
| 50 | + </DataTemplate> |
| 51 | + </ItemsControl.ItemTemplate> |
| 52 | + </ItemsControl> |
| 53 | + <ItemsControl ItemsSource="{Binding Items2}" |
73 | 54 | Grid.IsSharedSizeScope="True">
|
74 |
| - <ItemsControl.ItemTemplate> |
75 |
| - <DataTemplate DataType="{x:Type domain:SelectableViewModel}"> |
76 |
| - <Border x:Name="Border" Padding="8" BorderThickness="0 0 0 1" BorderBrush="{DynamicResource MaterialDesignDivider}"> |
77 |
| - <Grid> |
78 |
| - <Grid.ColumnDefinitions> |
79 |
| - <ColumnDefinition SharedSizeGroup="Checkerz" /> |
80 |
| - <ColumnDefinition /> |
81 |
| - </Grid.ColumnDefinitions> |
82 |
| - <ToggleButton VerticalAlignment="Center" IsChecked="{Binding IsSelected}" |
| 55 | + <ItemsControl.ItemTemplate> |
| 56 | + <DataTemplate DataType="{x:Type domain:SelectableViewModel}"> |
| 57 | + <Border x:Name="Border" Padding="8" BorderThickness="0 0 0 1" BorderBrush="{DynamicResource MaterialDesignDivider}"> |
| 58 | + <Grid> |
| 59 | + <Grid.ColumnDefinitions> |
| 60 | + <ColumnDefinition SharedSizeGroup="Checkerz" /> |
| 61 | + <ColumnDefinition /> |
| 62 | + </Grid.ColumnDefinitions> |
| 63 | + <ToggleButton VerticalAlignment="Center" IsChecked="{Binding IsSelected}" |
83 | 64 | Style="{StaticResource MaterialDesignActionLightToggleButton}"
|
84 | 65 | Content="{Binding Code}" />
|
85 |
| - <StackPanel Margin="8 0 0 0" Grid.Column="1"> |
86 |
| - <TextBlock FontWeight="Bold" Text="{Binding Name}" /> |
87 |
| - <TextBlock Text="{Binding Description}" /> |
88 |
| - </StackPanel> |
89 |
| - </Grid> |
90 |
| - </Border> |
91 |
| - <DataTemplate.Triggers> |
92 |
| - <DataTrigger Binding="{Binding IsSelected}" Value="True"> |
93 |
| - <Setter TargetName="Border" Property="Background" Value="{DynamicResource MaterialDesignSelection}" /> |
94 |
| - </DataTrigger> |
95 |
| - </DataTemplate.Triggers> |
96 |
| - </DataTemplate> |
97 |
| - </ItemsControl.ItemTemplate> |
98 |
| - </ItemsControl> |
99 |
| - </Grid> |
100 |
| - <TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Grid.Row="2" Margin="0 32 0 0">ListView</TextBlock> |
101 |
| - <ListView Grid.Row="3"> |
| 66 | + <StackPanel Margin="8 0 0 0" Grid.Column="1"> |
| 67 | + <TextBlock FontWeight="Bold" Text="{Binding Name}" /> |
| 68 | + <TextBlock Text="{Binding Description}" /> |
| 69 | + </StackPanel> |
| 70 | + </Grid> |
| 71 | + </Border> |
| 72 | + <DataTemplate.Triggers> |
| 73 | + <DataTrigger Binding="{Binding IsSelected}" Value="True"> |
| 74 | + <Setter TargetName="Border" Property="Background" Value="{DynamicResource MaterialDesignSelection}" /> |
| 75 | + </DataTrigger> |
| 76 | + </DataTemplate.Triggers> |
| 77 | + </DataTemplate> |
| 78 | + </ItemsControl.ItemTemplate> |
| 79 | + </ItemsControl> |
| 80 | + <TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Margin="0 32 0 0">ListView</TextBlock> |
| 81 | + <ListView > |
102 | 82 | <ListViewItem>
|
103 | 83 | Hello
|
104 | 84 | </ListViewItem>
|
|
109 | 89 | :)
|
110 | 90 | </ListViewItem>
|
111 | 91 | </ListView>
|
112 |
| - <TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Grid.Row="4" Margin="0 32 0 0">ListView.GridView</TextBlock> |
113 |
| - <ListView Grid.Row="5" ItemsSource="{Binding Items1}"> |
| 92 | + <TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Margin="0 32 0 0">ListView.GridView</TextBlock> |
| 93 | + <ListView ItemsSource="{Binding Items1}"> |
114 | 94 | <ListView.View>
|
115 | 95 | <GridView>
|
116 | 96 | <GridViewColumn DisplayMemberBinding="{Binding Code}" Header="Code" />
|
|
119 | 99 | </GridView>
|
120 | 100 | </ListView.View>
|
121 | 101 | </ListView>
|
122 |
| - </Grid> |
123 |
| - |
| 102 | + </codeDisplayer:XamlDisplayerPanel> |
| 103 | + |
124 | 104 | </UserControl>
|
0 commit comments