![](/img/trans.png)
[英]How to show context menu on a ListBoxItem template on a grid when right-clicking outside the contents of it?
[英]How to show file context menu in a grid with files
我有一个WPF网格,其中每一行代表磁盘上的一个文件。
我想做的是 当某人右键单击一行以显示与Windows资源管理器相同的上下文菜单时。 任何想法如何实现这一点? 我希望这会相对容易,但是不确定从哪里开始。
一些线索...
<Window.Resources>
<Style TargetType="DataGridRow">
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
<ContextMenu.Template>
<ControlTemplate>
<TextBox Text="{Binding <the property with which column is bound to>}" Height="30" Width="40" />
</ControlTemplate>
</ContextMenu.Template>
</ContextMenu>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.