wpf Treeview怎么在空白处绑定右键菜单

hanyujack 2010-10-18 03:10:44
<Style TargetType="{x:Type base:BopTreeViewBase}" x:Key="{ComponentResourceKey {x:Type local:CConditionSetOutlineListBox}, myStyle}">
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--
This Style binds a TreeViewItem to a TreeViewItemViewModel.
-->
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="ContextMenu" Value="{StaticResource {ComponentResourceKey {x:Type base:BopTreeViewBase}, bopMenuPopupOutlineConditionSetList }}" /> //这里已经绑定了Tree节点中的菜单
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="White" />

</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>

</Setter>
</Style>

请问如何在treeview在空白空点添加一个右键菜单.
...全文
329 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧