WPF 工具包数据网格标头和空源

发布于 2024-09-18 16:57:39 字数 273 浏览 1 评论 0 原文

如果没有可显示的行,如何使数据网格显示标题?

我的数据网格“完全”只读:

“AutoGenerateColumns =”True” “CanUserAddRows =”假” “CanUserDeleteRows =”假” “CanUserResizeRows =“假” “IsReadOnly”=“True”

如果没有行,则不会显示标题,如果我添加一个空行,则会显示标题!

到目前为止,我找不到任何解决方法/解决方案!

谢谢弗雷德

How could I make the Datagrid display the headers in case there's no row to display?

My Datagrid is "completely" read-only with:

"AutoGenerateColumns ="True"
"CanUserAddRows="False"
"CanUserDeleteRows="False"
"CanUserResizeRows="False"
"IsReadOnly"="True"

If there's no row, then the headers aren't displayed, if I add even an empty row, then the headers are shown!

Until now, I couldn't find any workaround/solution for that!

Thx all

Fred

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

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

发布评论

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

评论(3

横笛休吹塞上声 2024-09-25 16:57:39

AFAIK 如果没有行,则没有列,并且不会显示列标题。这对于行来说是相同的。如果没有行,则没有行标题。这是设计使然,我认为它应该是这样的。

现在要获取标题,您可以添加一个空行并使其不可见吗?当您添加包含内容的行时,请删除此行。

AFAIK If there are no rows then there are no columns and the column headers will not display. This is the same for the rows. If there are no rows then there are no row headers. This is by design and I think it is the way it should be.

Now to get your headers you could add an empty row and make it invisible? And remove this row when you add rows with content.

歌枕肩 2024-09-25 16:57:39

恐怕没有,这就是 wpf DataGrid 的制作方式(我也不喜欢这样......)

至于查找特定的行/单元格,您可以在那里查看:

http://techiethings.blogspot.com/2010/05/get -wpf-datagrid-row-and-cell.html

如果您使用虚拟化,请小心,因为它可能会给您带来一些麻烦。

I'm afraid there isn't, that's the way the wpf DataGrid was made (and I don't like that either...)

as for finding a particular row/cell, you can have a look there:

http://techiethings.blogspot.com/2010/05/get-wpf-datagrid-row-and-cell.html

be careful if you use virtualization though, as it might give you some trouble there.

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