![](/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.