|
11 | 11 | <UserControl.Resources>
|
12 | 12 | <ResourceDictionary>
|
13 | 13 | <ResourceDictionary.MergedDictionaries>
|
| 14 | + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" /> |
14 | 15 | <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml" />
|
| 16 | + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" /> |
15 | 17 | </ResourceDictionary.MergedDictionaries>
|
16 | 18 | </ResourceDictionary>
|
17 | 19 | </UserControl.Resources>
|
18 | 20 | <Grid>
|
19 | 21 | <Grid.ColumnDefinitions>
|
20 | 22 | <ColumnDefinition Width="Auto"/>
|
21 | 23 | <ColumnDefinition Width="Auto"/>
|
| 24 | + <ColumnDefinition Width="Auto"/> |
22 | 25 | </Grid.ColumnDefinitions>
|
23 | 26 | <Grid.RowDefinitions>
|
24 | 27 | <RowDefinition Height="Auto" />
|
25 | 28 | <RowDefinition Height="Auto" />
|
| 29 | + <RowDefinition Height="Auto" /> |
| 30 | + <RowDefinition Height="Auto" /> |
26 | 31 | </Grid.RowDefinitions>
|
27 |
| - <smtx:XamlDisplay Key="trees_1" Grid.Column="0" Margin="5 5 0 5" VerticalContentAlignment="Top"> |
| 32 | + <TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}">Basic Tree View:</TextBlock> |
| 33 | + <smtx:XamlDisplay Key="trees_1" Grid.Column="0" Grid.Row="1" VerticalContentAlignment="Top"> |
28 | 34 | <TreeView MinWidth="220">
|
29 | 35 | <TreeViewItem Header="Fruit">
|
30 | 36 | <TreeViewItem>
|
|
94 | 100 | <TreeViewItem Header="Empty" />
|
95 | 101 | </TreeView>
|
96 | 102 | </smtx:XamlDisplay>
|
97 |
| - <smtx:XamlDisplay Key="trees_2" Grid.Column="1" VerticalAlignment="Top" Margin="5" VerticalContentAlignment="Top"> |
| 103 | + |
| 104 | + <TextBlock Grid.Column="1" Margin="32 0 0 0" Style="{StaticResource MaterialDesignTitleTextBlock}">MVVM/Binding:</TextBlock> |
| 105 | + <smtx:XamlDisplay Key="trees_2" Grid.Column="1" Grid.Row="1" |
| 106 | + Margin="32 0 0 0" |
| 107 | + VerticalAlignment="Top" VerticalContentAlignment="Top"> |
98 | 108 | <Grid MinWidth="220">
|
99 | 109 | <Grid.RowDefinitions>
|
100 | 110 | <RowDefinition Height="*"/>
|
|
141 | 151 | </materialDesign:PopupBox>
|
142 | 152 | </Grid>
|
143 | 153 | </smtx:XamlDisplay>
|
144 |
| - <smtx:XamlDisplay Key="trees_3" Grid.Row="1"> |
| 154 | + |
| 155 | + <TextBlock Grid.Row="2" Style="{StaticResource MaterialDesignTitleTextBlock}">Additional node content, syntax 1:</TextBlock> |
| 156 | + <smtx:XamlDisplay Key="trees_3" Grid.Row="3"> |
145 | 157 | <TreeView>
|
146 | 158 | <materialDesign:TreeViewAssist.AdditionalTemplate>
|
147 | 159 | <DataTemplate>
|
148 |
| - <TextBlock FontSize="10" Margin="8">8 planets</TextBlock> |
| 160 | + <materialDesign:ColorZone Mode="PrimaryLight" CornerRadius="6"> |
| 161 | + <TextBlock FontSize="10" Margin="8 1 8 1" FontStyle="Italic">8 planets</TextBlock> |
| 162 | + </materialDesign:ColorZone> |
149 | 163 | </DataTemplate>
|
150 | 164 | </materialDesign:TreeViewAssist.AdditionalTemplate>
|
151 |
| - <!-- |
| 165 | + <TreeViewItem Header="Solar System"> |
| 166 | + <TreeViewItem Header="Mercury" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 167 | + <TreeViewItem Header="Venus" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 168 | + <TreeViewItem Header="Earth" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 169 | + <TreeViewItem Header="Mars" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 170 | + <TreeViewItem Header="Jupiter" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 171 | + <TreeViewItem Header="Saturn" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 172 | + <TreeViewItem Header="Uranus" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 173 | + <TreeViewItem Header="Neptune" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 174 | + </TreeViewItem> |
| 175 | + </TreeView> |
| 176 | + </smtx:XamlDisplay> |
| 177 | + |
| 178 | + <TextBlock Grid.Row="2" Grid.Column="1" Margin="32 0 0 0" Style="{StaticResource MaterialDesignTitleTextBlock}">Additional node content, syntax 2:</TextBlock> |
| 179 | + <smtx:XamlDisplay Key="trees_4" Grid.Row="3" Grid.Column="1" Margin="32 0 0 0" > |
| 180 | + <TreeView> |
152 | 181 | <materialDesign:TreeViewAssist.AdditionalTemplateSelector>
|
153 | 182 | <domain:TreeExampleSimpleTemplateSelector>
|
154 | 183 | <domain:TreeExampleSimpleTemplateSelector.SolarSystemTemplate>
|
155 | 184 | <DataTemplate>
|
156 |
| - <TextBlock>8 or 9 planets?</TextBlock> |
| 185 | + <materialDesign:ColorZone Mode="Accent" CornerRadius="6" materialDesign:ShadowAssist.ShadowDepth="Depth1" |
| 186 | + Margin="2"> |
| 187 | + <DockPanel LastChildFill="True"> |
| 188 | + <Button Style="{DynamicResource MaterialDesignToolForegroundButton}" Margin="8 -6 8 -6" DockPanel.Dock="Right"> |
| 189 | + <materialDesign:PackIcon Kind="Magnify" /> |
| 190 | + </Button> |
| 191 | + <TextBlock FontSize="11" Margin="8 0 0 0" VerticalAlignment="Center" FontStyle="Italic">8 planets</TextBlock> |
| 192 | + </DockPanel> |
| 193 | + </materialDesign:ColorZone> |
157 | 194 | </DataTemplate>
|
158 | 195 | </domain:TreeExampleSimpleTemplateSelector.SolarSystemTemplate>
|
159 | 196 | </domain:TreeExampleSimpleTemplateSelector>
|
160 | 197 | </materialDesign:TreeViewAssist.AdditionalTemplateSelector>
|
161 |
| - --> |
162 | 198 | <TreeViewItem Header="Solar System">
|
163 |
| - <TreeViewItem Header="Mercury" materialDesign:TreeViewAssist.AdditionalTemplate="{x:Static materialDesign:TreeViewAssist.SuppressAdditionalTemplate}" /> |
| 199 | + <TreeViewItem Header="Mercury" /> |
164 | 200 | <TreeViewItem Header="Venus" />
|
165 | 201 | <TreeViewItem Header="Earth" />
|
166 | 202 | <TreeViewItem Header="Mars" />
|
|
171 | 207 | </TreeViewItem>
|
172 | 208 | </TreeView>
|
173 | 209 | </smtx:XamlDisplay>
|
| 210 | + |
| 211 | + <TextBlock Grid.Row="2" Grid.Column="2" Margin="32 0 0 0" Style="{StaticResource MaterialDesignTitleTextBlock}">Additional node content, showcase:</TextBlock> |
| 212 | + <smtx:XamlDisplay Key="trees_5" Grid.Row="3" Grid.Column="2" Margin="32 0 0 0" > |
| 213 | + <TreeView DisplayMemberPath="Name" MinWidth="220"> |
| 214 | + <TreeView.Resources> |
| 215 | + <DataTemplate DataType="{x:Type domain:Planet}"> |
| 216 | + <StackPanel Orientation="Horizontal"> |
| 217 | + <materialDesign:PackIcon Kind="GoogleEarth" /> |
| 218 | + <TextBlock Text="{Binding Name,Mode=OneTime}" Margin="12 0 0 0" /> |
| 219 | + </StackPanel> |
| 220 | + </DataTemplate> |
| 221 | + </TreeView.Resources> |
| 222 | + <materialDesign:TreeViewAssist.AdditionalTemplateSelector> |
| 223 | + <domain:TreeExampleSimpleTemplateSelector> |
| 224 | + <domain:TreeExampleSimpleTemplateSelector.SolarSystemTemplate> |
| 225 | + <DataTemplate> |
| 226 | + <materialDesign:ColorZone Mode="Standard" CornerRadius="6" materialDesign:ShadowAssist.ShadowDepth="Depth1" |
| 227 | + Margin="2"> |
| 228 | + <DockPanel LastChildFill="True"> |
| 229 | + <Button Style="{DynamicResource MaterialDesignToolForegroundButton}" Margin="8 -6 8 -6" DockPanel.Dock="Right"> |
| 230 | + <materialDesign:PackIcon Kind="Magnify" /> |
| 231 | + </Button> |
| 232 | + <TextBlock FontSize="11" Margin="8 0 0 0" VerticalAlignment="Center" FontStyle="Italic">8 planets</TextBlock> |
| 233 | + </DockPanel> |
| 234 | + </materialDesign:ColorZone> |
| 235 | + </DataTemplate> |
| 236 | + </domain:TreeExampleSimpleTemplateSelector.SolarSystemTemplate> |
| 237 | + <domain:TreeExampleSimpleTemplateSelector.PlanetTemplate> |
| 238 | + <DataTemplate DataType="{x:Type domain:Planet}"> |
| 239 | + <Grid TextElement.FontSize="10" TextElement.FontStyle="Italic" Margin="8 0 0 0"> |
| 240 | + <Grid.RowDefinitions> |
| 241 | + <RowDefinition Height="Auto" /> |
| 242 | + <RowDefinition Height="Auto" /> |
| 243 | + </Grid.RowDefinitions> |
| 244 | + <Grid.ColumnDefinitions> |
| 245 | + <ColumnDefinition Width="Auto" /> |
| 246 | + <ColumnDefinition Width="Auto" /> |
| 247 | + <ColumnDefinition Width="Auto" /> |
| 248 | + <ColumnDefinition Width="Auto" /> |
| 249 | + </Grid.ColumnDefinitions> |
| 250 | + <TextBlock Text="From Sun" /> |
| 251 | + <TextBlock Grid.Column="1" Margin="3 0 0 0" Text="{Binding DistanceFromSun, Mode=OneTime, StringFormat={}{0}AU}" /> |
| 252 | + <TextBlock Grid.Row="1" Text="From Earth" /> |
| 253 | + <TextBlock Grid.Row="1" Grid.Column="1" Margin="3 0 0 0" Text="{Binding DistanceFromEarth,Mode=OneTime, StringFormat={}{0}AU}" /> |
| 254 | + <TextBlock Grid.Column="2" Text="Velocity" Margin="12 0 0 0" /> |
| 255 | + <TextBlock Grid.Column="3" Margin="3 0 0 0" Text="{Binding Velocity,Mode=OneTime, StringFormat={}{0}km/s}" /> |
| 256 | + </Grid> |
| 257 | + </DataTemplate> |
| 258 | + </domain:TreeExampleSimpleTemplateSelector.PlanetTemplate> |
| 259 | + </domain:TreeExampleSimpleTemplateSelector> |
| 260 | + </materialDesign:TreeViewAssist.AdditionalTemplateSelector> |
| 261 | + <TreeViewItem Header="Solar System"> |
| 262 | + <domain:Planet Name="Mercury" DistanceFromSun=".42" DistanceFromEarth="1.4" Velocity="44.29" /> |
| 263 | + <domain:Planet Name="Venus" DistanceFromSun=".73" DistanceFromEarth="1.69" Velocity="34.82" /> |
| 264 | + <domain:Planet Name="Earth" DistanceFromSun="0.99" DistanceFromEarth="0" Velocity="30.16" /> |
| 265 | + <domain:Planet Name="Mars" DistanceFromSun="1.59" DistanceFromEarth="1.55" Velocity="23.12" /> |
| 266 | + <domain:Planet Name="Jupiter" DistanceFromSun="5.43" DistanceFromEarth="5.29" Velocity="12.51" /> |
| 267 | + <domain:Planet Name="Saturn" DistanceFromSun="10.07" DistanceFromEarth="10.69" Velocity="9.14" /> |
| 268 | + <domain:Planet Name="Uranus" DistanceFromSun="19.90" DistanceFromEarth="20.37" Velocity="6.55" /> |
| 269 | + <domain:Planet Name="Neptune" DistanceFromSun="29.94" DistanceFromEarth="30.88" Velocity="5.45" /> |
| 270 | + </TreeViewItem> |
| 271 | + </TreeView> |
| 272 | + </smtx:XamlDisplay> |
174 | 273 | </Grid>
|
175 | 274 | </UserControl>
|
176 | 275 |
|
0 commit comments