17,741
社区成员
发帖
与我相关
我的任务
分享
<UserControl x:Class="WpfContrl.WpfTreeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cal="http://www.caliburnproject.org"
xmlns:model="clr-namespace:WpfContrl"
mc:Ignorable="d"
d:DesignHeight="414" d:DesignWidth="461">
<UserControl.Resources>
</UserControl.Resources>
<!--DataType="{x:Type model:DepartmentModel}" Style="{DynamicResource TreeViewStyle1}" -->
<DockPanel Name="DockPanel1" LastChildFill="True">
<TreeView Margin="0,0,0,0" Name="treeView1" Background="#34373E" TreeViewItem.Selected="tvListDataTable_Selected">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Nodes, IsAsync=True}">
<StackPanel Orientation="Horizontal" Background="Red">
<Image VerticalAlignment="Center" Source="{Binding Path=Icon}" Width="16" Height="16" Margin="0,0,2,2"></Image>
<TextBlock VerticalAlignment="Center" FontSize="14" Text="{Binding Path=deptName}" Margin="2,0,0,0" ></TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</DockPanel>
</UserControl>