47 lines
2.1 KiB
Plaintext
47 lines
2.1 KiB
Plaintext
|
|
<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">
|
||
|
|
<TreeView.Resources>
|
||
|
|
<!-- Checkbox节点的样式 -->
|
||
|
|
<HierarchicalDataTemplate DataType="{x:Type local:CheckboxTreeNode}" ItemsSource="{Binding Children}">
|
||
|
|
<StackPanel Orientation="Horizontal">
|
||
|
|
<CheckBox IsChecked="{Binding IsChecked}"
|
||
|
|
Content="{Binding Text}"
|
||
|
|
Tag="{Binding Tag}">
|
||
|
|
<!-- 鼠标悬停时显示 Tag 内容 -->
|
||
|
|
<CheckBox.ToolTip>
|
||
|
|
<ToolTip Content="{Binding Tag}" />
|
||
|
|
</CheckBox.ToolTip>
|
||
|
|
</CheckBox>
|
||
|
|
</StackPanel>
|
||
|
|
</HierarchicalDataTemplate>
|
||
|
|
|
||
|
|
<!-- Label节点的样式 -->
|
||
|
|
<HierarchicalDataTemplate DataType="{x:Type local:LabelTreeNode}" ItemsSource="{Binding Children}">
|
||
|
|
<Label Content="{Binding Text}" VerticalAlignment="Center"/>
|
||
|
|
</HierarchicalDataTemplate>
|
||
|
|
|
||
|
|
|
||
|
|
<!-- Combobox节点的样式 -->
|
||
|
|
<HierarchicalDataTemplate DataType="{x:Type local:ComboboxTreeNode}" ItemsSource="{Binding Children}">
|
||
|
|
<StackPanel Orientation="Horizontal">
|
||
|
|
<Label Content="{Binding Text}"/>
|
||
|
|
<ComboBox SelectedIndex="0"/>
|
||
|
|
</StackPanel>
|
||
|
|
</HierarchicalDataTemplate>
|
||
|
|
|
||
|
|
</TreeView.Resources>
|
||
|
|
</TreeView>
|
||
|
|
</Grid>
|
||
|
|
|
||
|
|
</UserControl>
|