|
33 | 33 | </Grid.ColumnDefinitions> |
34 | 34 |
|
35 | 35 | <Grid.RowDefinitions> |
| 36 | + <RowDefinition Height="Auto" /> |
| 37 | + <RowDefinition Height="Auto" MaxHeight="450" /> |
36 | 38 | <RowDefinition Height="Auto" /> |
37 | 39 | <RowDefinition Height="Auto" MaxHeight="450" /> |
38 | 40 | <RowDefinition Height="Auto" /> |
|
203 | 205 | </Grid> |
204 | 206 | </smtx:XamlDisplay> |
205 | 207 |
|
206 | | - <TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" Text="Multi-Select Tree View:" |
207 | | - Grid.Column="2"/> |
208 | | - <smtx:XamlDisplay Grid.Row="1" |
209 | | - Grid.Column="2" |
210 | | - VerticalContentAlignment="Top" |
211 | | - UniqueKey="trees_3"> |
| 208 | + <TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" Text="Multi-Select Tree List View:" |
| 209 | + Grid.Row="2" |
| 210 | + Grid.Column="0" |
| 211 | + Margin="0,40,0,0"/> |
| 212 | + <smtx:XamlDisplay Grid.Row="3" |
| 213 | + Grid.Column="0" |
| 214 | + VerticalContentAlignment="Top" |
| 215 | + UniqueKey="trees_3" |
| 216 | + Margin="0,75,0,20"> |
212 | 217 | <Grid> |
213 | 218 | <materialDesign:TreeListView MinWidth="220" MaxHeight="450" |
214 | 219 | ItemsSource="{Binding TreeItems}" |
215 | 220 | SelectedItem="{Binding SelectedTreeItem}"> |
216 | 221 | <materialDesign:TreeListView.Resources> |
217 | | - <HierarchicalDataTemplate DataType="{x:Type domain:TestItem}" |
218 | | - ItemsSource="{Binding Items, Mode=OneTime}"> |
219 | | - <TextBlock Margin="3,2" Text="{Binding Name, Mode=OneTime}" /> |
| 222 | + <HierarchicalDataTemplate DataType="{x:Type domain:TestItem}" ItemsSource="{Binding Items, Mode=OneTime}"> |
| 223 | + <TextBlock VerticalAlignment="Center" Text="{Binding Name, Mode=OneTime}" /> |
220 | 224 | </HierarchicalDataTemplate> |
221 | 225 |
|
222 | 226 | <HierarchicalDataTemplate DataType="{x:Type domain:MovieCategory}" |
|
231 | 235 | </DataTemplate> |
232 | 236 | </materialDesign:TreeListView.Resources> |
233 | 237 |
|
234 | | - <!-- |
235 | | - Because Data Virtualization is enabled on this tree view by default, if you don't bind the IsExpanded property to something in the bound view model, |
236 | | - you can loose the expanded state of items when the TreeListViewItem is recycled. |
237 | | -
|
238 | | - For more information: |
239 | | - https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/3640#issuecomment-2274086113 |
240 | | - https://learn.microsoft.com/dotnet/desktop/wpf/advanced/optimizing-performance-controls?view=netframeworkdesktop-4.8&WT.mc_id=DT-MVP-5003472 |
241 | | - --> |
| 238 | + <!-- |
| 239 | + Because Data Virtualization is enabled on this tree view by default, if you don't bind the IsExpanded property to something in the bound view model, |
| 240 | + you can loose the expanded state of items when the TreeListViewItem is recycled. |
| 241 | + |
| 242 | + For more information: |
| 243 | + https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/3640#issuecomment-2274086113 |
| 244 | + https://learn.microsoft.com/dotnet/desktop/wpf/advanced/optimizing-performance-controls?view=netframeworkdesktop-4.8&WT.mc_id=DT-MVP-5003472 |
| 245 | + --> |
242 | 246 | <materialDesign:TreeListView.ItemContainerStyle> |
243 | 247 | <Style TargetType="materialDesign:TreeListViewItem" BasedOn="{StaticResource {x:Type materialDesign:TreeListViewItem}}"> |
244 | 248 | <Setter Property="IsExpanded" Value="{Binding IsExpanded}" /> |
245 | 249 | </Style> |
246 | 250 | </materialDesign:TreeListView.ItemContainerStyle> |
| 251 | + |
247 | 252 | </materialDesign:TreeListView> |
248 | 253 | <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right"> |
249 | 254 | <Button Command="{Binding AddListTreeItemCommand}" |
|
258 | 263 | </Grid> |
259 | 264 | </smtx:XamlDisplay> |
260 | 265 |
|
261 | | - <TextBlock Grid.Row="2" |
| 266 | + <TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" |
| 267 | + Text="Multi-Select Tree Grid View:" |
| 268 | + Grid.Row="2" |
| 269 | + Grid.Column="1" |
| 270 | + Margin="0,40,0,0" /> |
| 271 | + <smtx:XamlDisplay Grid.Row="3" |
| 272 | + Grid.Column="1" |
| 273 | + VerticalContentAlignment="Top" |
| 274 | + UniqueKey="trees_7" |
| 275 | + Margin="0,20,0,20"> |
| 276 | + <Grid> |
| 277 | + <materialDesign:TreeListView MinWidth="220" |
| 278 | + MaxHeight="450" |
| 279 | + ItemsSource="{Binding TreeItems}" |
| 280 | + SelectedItem="{Binding SelectedTreeItem}"> |
| 281 | + <materialDesign:TreeListView.Resources> |
| 282 | + <HierarchicalDataTemplate DataType="{x:Type domain:TestItem}" |
| 283 | + ItemsSource="{Binding Items, Mode=OneTime}"> |
| 284 | + <TextBlock VerticalAlignment="Center" |
| 285 | + Text="{Binding Name, Mode=OneTime}" /> |
| 286 | + </HierarchicalDataTemplate> |
| 287 | + |
| 288 | + <HierarchicalDataTemplate DataType="{x:Type domain:MovieCategory}" |
| 289 | + ItemsSource="{Binding Movies, Mode=OneTime}"> |
| 290 | + <TextBlock Margin="3,2" |
| 291 | + Text="{Binding Name, Mode=OneTime}" /> |
| 292 | + </HierarchicalDataTemplate> |
| 293 | + |
| 294 | + <DataTemplate DataType="{x:Type domain:Movie}"> |
| 295 | + <TextBlock Margin="3,2" |
| 296 | + Text="{Binding Name, Mode=OneTime}" |
| 297 | + ToolTip="{Binding Director, Mode=OneTime}" /> |
| 298 | + </DataTemplate> |
| 299 | + </materialDesign:TreeListView.Resources> |
| 300 | + |
| 301 | + <materialDesign:TreeListView.ItemContainerStyle> |
| 302 | + <Style TargetType="materialDesign:TreeListViewItem" |
| 303 | + BasedOn="{StaticResource {x:Type materialDesign:TreeListViewItem}}"> |
| 304 | + <Setter Property="IsExpanded" |
| 305 | + Value="{Binding IsExpanded}" /> |
| 306 | + </Style> |
| 307 | + </materialDesign:TreeListView.ItemContainerStyle> |
| 308 | + |
| 309 | + <materialDesign:TreeListView.View> |
| 310 | + <GridView> |
| 311 | + <GridView.Columns> |
| 312 | + <GridViewColumn Width="250" |
| 313 | + Header="Name"> |
| 314 | + <GridViewColumn.CellTemplate> |
| 315 | + <DataTemplate> |
| 316 | + <TextBlock VerticalAlignment="Center" |
| 317 | + Text="{Binding Name, Mode=OneTime}" /> |
| 318 | + </DataTemplate> |
| 319 | + </GridViewColumn.CellTemplate> |
| 320 | + </GridViewColumn> |
| 321 | + |
| 322 | + <GridViewColumn Width="100" |
| 323 | + Header="Count"> |
| 324 | + <GridViewColumn.CellTemplate> |
| 325 | + <DataTemplate> |
| 326 | + <TextBlock VerticalAlignment="Center" |
| 327 | + Text="{Binding Items.Count, Mode=OneWay}" /> |
| 328 | + </DataTemplate> |
| 329 | + </GridViewColumn.CellTemplate> |
| 330 | + </GridViewColumn> |
| 331 | + </GridView.Columns> |
| 332 | + </GridView> |
| 333 | + </materialDesign:TreeListView.View> |
| 334 | + </materialDesign:TreeListView> |
| 335 | + <StackPanel Orientation="Horizontal" |
| 336 | + VerticalAlignment="Bottom" |
| 337 | + HorizontalAlignment="Right"> |
| 338 | + <Button Command="{Binding AddListTreeItemCommand}" |
| 339 | + ToolTip="Add an item" |
| 340 | + Content="{materialDesign:PackIcon Kind=Add}" /> |
| 341 | + |
| 342 | + <Button Command="{Binding RemoveListTreeItemCommand}" |
| 343 | + ToolTip="Remove selected item(s)" |
| 344 | + Content="{materialDesign:PackIcon Kind=Remove}" /> |
| 345 | + |
| 346 | + </StackPanel> |
| 347 | + </Grid> |
| 348 | + </smtx:XamlDisplay> |
| 349 | + |
| 350 | + <TextBlock Grid.Row="4" |
262 | 351 | Style="{StaticResource PageSectionTitleTextBlock}" |
263 | 352 | Text="Additional node content, syntax 1" /> |
264 | 353 |
|
265 | | - <smtx:XamlDisplay Grid.Row="3" |
| 354 | + <smtx:XamlDisplay Grid.Row="5" |
266 | 355 | UniqueKey="trees_4"> |
267 | 356 | <TreeView> |
268 | 357 | <materialDesign:TreeViewAssist.AdditionalTemplate> |
|
305 | 394 | </TreeView> |
306 | 395 | </smtx:XamlDisplay> |
307 | 396 |
|
308 | | - <TextBlock Grid.Row="2" |
| 397 | + <TextBlock Grid.Row="4" |
309 | 398 | Grid.Column="1" |
310 | 399 | Margin="32,0,0,0" |
311 | 400 | Style="{StaticResource PageSectionTitleTextBlock}" |
312 | 401 | Text="Additional node content, syntax 2" /> |
313 | 402 |
|
314 | | - <smtx:XamlDisplay Grid.Row="3" |
| 403 | + <smtx:XamlDisplay Grid.Row="5" |
315 | 404 | Grid.Column="1" |
316 | 405 | Margin="32,0,0,0" |
317 | 406 | UniqueKey="trees_5"> |
|
355 | 444 | </TreeView> |
356 | 445 | </smtx:XamlDisplay> |
357 | 446 |
|
358 | | - <TextBlock Grid.Row="2" |
| 447 | + <TextBlock Grid.Row="4" |
359 | 448 | Grid.Column="2" |
360 | 449 | Margin="32,0,0,0" |
361 | 450 | Style="{StaticResource PageSectionTitleTextBlock}" |
362 | 451 | Text="Additional node content, showcase" /> |
363 | 452 |
|
364 | | - <smtx:XamlDisplay Grid.Row="3" |
| 453 | + <smtx:XamlDisplay Grid.Row="5" |
365 | 454 | Grid.Column="2" |
366 | 455 | Margin="32,0,0,0" |
367 | 456 | UniqueKey="trees_6"> |
|
0 commit comments