wpf treeview 怎么获取节点的值
<TreeViewx:Name="departmentTree"HorizontalAlignment="Left"Height="auto"Width="280"Pad...
<TreeView x:Name="departmentTree" HorizontalAlignment="Left" Height="auto" Width="280" Padding="20" SelectedItemChanged="departmentTree_SelectedItemChanged" BorderBrush="#FFE0DDDD" TreeViewItem.Selected="treeview_selected" >
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Nodes}" >
<DockPanel Margin="0,20,0,20" Width="200" >
<Image Source="{Binding picture}" Height="24" Width="24" />
<TextBlock Text="{Binding menuName}" Margin="30,0,0,0" VerticalAlignment="Center" FontSize="16" Foreground="Black" Name="Data"/>
</DockPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate> 展开
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Nodes}" >
<DockPanel Margin="0,20,0,20" Width="200" >
<Image Source="{Binding picture}" Height="24" Width="24" />
<TextBlock Text="{Binding menuName}" Margin="30,0,0,0" VerticalAlignment="Center" FontSize="16" Foreground="Black" Name="Data"/>
</DockPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate> 展开
1个回答
展开全部
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
Response.Write(TreeView1.SelectedNode.Value);
}
protected void Button1_Click(object sender, EventArgs e)
{
if(TreeView1.SelectedNode!=null)
Response.Write("获取当前节点的value:" + TreeView1.SelectedNode.Value);
}
{
Response.Write(TreeView1.SelectedNode.Value);
}
protected void Button1_Click(object sender, EventArgs e)
{
if(TreeView1.SelectedNode!=null)
Response.Write("获取当前节点的value:" + TreeView1.SelectedNode.Value);
}
追问
treeview 控件有SelectedNode??
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询