访问 WPF DataGrid“空”或“行列”标头
我试图访问 Net3.5 WPF DataGrid 中行标题和列标题交叉处的标题。
乔什·史密斯(Josh Smith)在有关不同网格控件的文章中将其称为“空标题”,我将其称为“RowColumn”标题,因为它位于列标题和行标题的第一个位置,并且是唯一同时属于两者的标题。它默认是一个带有右下箭头的按钮,按下该按钮会选择 DataGrid 中的所有项目。我可以在 snoop 中看到此按钮,但无法弄清楚如何访问此标头。
我需要停止按钮选择网格中的所有项目,并在其位置添加一个菜单或一个保留按钮但向其添加文本的上下文菜单。
由于我不清楚文档中的名称,因此我不知道要搜索什么。我已经尝试过对我来说显而易见的方法。
I am trying to get access to the header that is at the intersection of the rows and columns headers in a Net3.5 WPF DataGrid.
Josh Smith calls this the "Empty Header" in an article on a different grid control and I would call it the "RowColumn" header since it in the first position for both the column and row headers and is the only header that is part of both. It defaults to a button with a lower right hand arrow that when you press selects all the items in the DataGrid. I can see this button in snoop but cannot work out how to get access to this header.
I need to stop the button selecting all the items in the grid and add either a menu in its place or a context menu that is keeping the button but adding text to it.
Since I am unclear about what this is even called in the documentation, I have no idea what to search on. I have tried the, to me, obvious ones.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我花了一段时间才找到这个,决定自己接受挑战,因为我不能立即知道答案。左上角的按钮没有内置控件,这使得它有点复杂。好消息是,您可以在加载时覆盖“SelectAllButtonTemplate”。
我不确定你想用什么替换它,但是 这里有一个关于如何执行此操作的教程。此外,您可能会发现这个过去的问题很有帮助。祝你好运,先生。
It took me awhile to find this, decided I wanted to take on the challenge myself since I didn't know the answer straight away. There is not a built in control for that button in the top left, which makes it a little more complicated. The good news is, you can override the "SelectAllButtonTemplate" on load.
I'm not sure what you want to replace it with, but here is a tutorial on how to do it. Also you might find this past question helpful. Good luck sir.