WPF:
XAML
<TreeView x:Name="treeView_Set" Grid.Column="0" FontSize="25" Margin="5,5,5,5">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=Children}">
<TextBlock Text="{Binding TreeViewItemName}" ContextMenu="{Binding TreeContentMenu}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
这里需要新增一个类:
/// <summary>
/// 可视化树节点的结构定义
/// TreeViewItemName 树节点名
/// TreeContentMenu 树节点名(显示)
/// Children 子数
/// </summary>
public class TreeViewItemIPU
{
private string _treeViewItemName;
public string TreeViewItemName
{
get { return _treeViewItemName; }
set { _treeViewIte