Files
Ramitta-lib/Ramitta/winTreeList.xaml

38 lines
2.0 KiB
XML

<UserControl x:Class="Ramitta.winTreeList"
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:local="clr-namespace:Ramitta"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TreeView x:Name="treeView"
Background="{Binding TreeViewBackground, RelativeSource={RelativeSource AncestorType=UserControl}}"
BorderBrush="{Binding TreeViewBorderBrush, RelativeSource={RelativeSource AncestorType=UserControl}}">
<TreeView.Resources>
<!-- Checkbox节点的样式 -->
<HierarchicalDataTemplate DataType="{x:Type local:CheckboxTreeNode}" ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<ContentControl Content="{Binding obj}" />
</StackPanel>
</HierarchicalDataTemplate>
<!-- Label节点的样式 -->
<HierarchicalDataTemplate DataType="{x:Type local:LabelTreeNode}" ItemsSource="{Binding Children}">
<ContentControl Content="{Binding obj}" />
</HierarchicalDataTemplate>
<!-- Combobox节点的样式 -->
<HierarchicalDataTemplate DataType="{x:Type local:ComboboxTreeNode}" ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Text}" Foreground="White"/>
<ContentControl Content="{Binding obj}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
</Grid>
</UserControl>