简体   繁体   English

如何在包含文件的网格中显示文件上下文菜单

[英]How to show file context menu in a grid with files

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. 当某人右键单击一行以显示与Windows资源管理器相同的上下文菜单时。 Any ideas how to implement this? 任何想法如何实现这一点? I'm hoping that it will be relative easy but have not sure where to start with this. 我希望这会相对容易,但是不确定从哪里开始。

在此处输入图片说明

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM