访问WPF DataGrid“空”或“行列”标题 [英] Accessing the WPF DataGrid "empty" or "rowcolumn" header

查看:412
本文介绍了访问WPF DataGrid“空”或“行列”标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图访问Net3.5 WPF DataGrid中行列列标题的标题。

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称之为在另一个网格控件上的文章中的空头,我将其称为RowColumn头,因为它位于列和行标题的第一个位置,并且是唯一的标题,它们是两者的一部分。它默认为一个带右下角箭头的按钮,当您按下时选择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.

推荐答案

花了我一段时间找到这个,决定我想要自我挑战,因为我不知道答案。左上方没有内置的按钮,这使得它更复杂一些。好消息是,您可以在加载时覆盖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.

我不知道您要替换什么,但 here是一个关于如何做的教程。另外,您可能会发现此过去的问题有帮助。祝你好运先生。

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.

这篇关于访问WPF DataGrid“空”或“行列”标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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