添加不同的上下文菜单DataGrid的头 [英] Adding different context menu for datagrid's header

查看:98
本文介绍了添加不同的上下文菜单DataGrid的头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想补充一个不同的上下文菜单上我的WPF DataGrid的标题。我该怎么办呢?

I want to add a different context menu for my datagrid's header on WPF. How can I do that?

推荐答案

这些资源将帮助你的方式:

These resources will help you on the way:

  • Context Menus in WPF
  • WPF Context Menus
  • How to create Custom WPF Context Menus

WPF XAML使用的是另一种标记语言,一个常见的​​事情,你usualy看到的是,标签上有很多控制重用。在上面的例子中,你可以看到,像控制

WPF used XAML which is another Markup Language and one common thing that you usualy see is that tags are reused on a lot of controls. In the examples above you can see that controls like

Control.ContextMenu 在这里你可以创造特定的菜单用于该项目。从上面的第一个环节采取请参见本例的的RichTextBox

Has the Control.ContextMenuwhere you can creat your specific menu for that item. Taken from the first link above, see this example on RichTextBox

<RichTextBox>
    <RichTextBox.ContextMenu>
        <ContextMenu>
        </ContextMenu>
    </RichTextBox.ContextMenu> 
</RichTextBox>

和这并不只适用于文本菜单!还有这样的其他可重用的元素。根据什么DataGrid中使用的是,你要考虑的是,API,但它很有可能是它的工作方式是这样的。

And this doesn't apply only to the ContextMenu! There are other reusable elements like this. Depending on what DataGrid you are using, you have to look into the API for that but it is most likely working its ways like this.

这篇关于添加不同的上下文菜单DataGrid的头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆