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

发布于 2025-01-07 04:16:37 字数 255 浏览 1 评论 0原文

我有一个 WPF 网格,其中每一行代表磁盘上的一个文件。

grid

我想做的是;当某人右键单击一行以显示与 Windows 资源管理器显示的相同上下文菜单时。有什么想法如何实现这一点?我希望这会相对容易,但不知道从哪里开始。

在此处输入图像描述

I've got a WPF grid in which each row represents a file on disk.

grid

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.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

誰ツ都不明白 2025-01-14 04:16:37

一些线索...

<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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文