I've got a WPF grid in which each row represents a file on disk.
我有一个WPF网格,其中每一行表示磁盘上的一个文件。
What I'd like to do is; when someone right-clicks on a row to show the same context menu as Windows Explorer shows. Any ideas how to implement this? I'm hoping that it will be relative easy but have not sure where to start with this.
我想做的是;当某人右键单击一行以显示与Windows资源管理器显示相同的上下文菜单时。有什么想法吗?我希望这是相对容易的,但不确定从哪里开始。
1 个解决方案
#1
0
Some clue...
一些线索……
<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>
#1
0
Some clue...
一些线索……
<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>