ObjectInTreeView.xaml 1.5 KB

123456789101112131415161718192021222324252627282930
  1. <UserControl x:Class="MECF.Framework.UI.Core.ExtendedControls.ObjectInTreeView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:extendedControls="clr-namespace:MECF.Framework.UI.Core.ExtendedControls"
  7. mc:Ignorable="d"
  8. x:Name="self"
  9. d:DesignHeight="300" d:DesignWidth="300">
  10. <TreeView ItemsSource="{Binding TreeNodes, ElementName=self}">
  11. <TreeView.Resources>
  12. <Style TargetType="{x:Type TreeViewItem}">
  13. <Setter Property="IsExpanded" Value="True">
  14. </Setter>
  15. </Style>
  16. <HierarchicalDataTemplate DataType="{x:Type extendedControls:ObjectTreeNode}" ItemsSource="{Binding Path=Children}">
  17. <TreeViewItem>
  18. <TreeViewItem.Header>
  19. <StackPanel Orientation="Horizontal">
  20. <TextBlock Text="{Binding Path=Name}"/>
  21. <TextBlock Text=" : "/>
  22. <TextBlock Text="{Binding Path=Value}"/>
  23. </StackPanel>
  24. </TreeViewItem.Header>
  25. </TreeViewItem>
  26. </HierarchicalDataTemplate>
  27. </TreeView.Resources>
  28. </TreeView>
  29. </UserControl>