WPF 工具包数据网格标头和空源
如果没有可显示的行,如何使数据网格显示标题?
我的数据网格“完全”只读:
“AutoGenerateColumns =”True” “CanUserAddRows =”假” “CanUserDeleteRows =”假” “CanUserResizeRows =“假” “IsReadOnly”=“True”
如果没有行,则不会显示标题,如果我添加一个空行,则会显示标题!
到目前为止,我找不到任何解决方法/解决方案!
谢谢弗雷德
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
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.
恐怕没有,这就是 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.
这实际上是“设计使然”。检查http://connect.microsoft。 com/VisualStudio/feedback/details/538210/wpf-datagrid-with-autogeneratecolumns-shows-nothing该问题似乎已在 4.5 中修复,任务已关闭。请检查 http://connect.microsoft.com/VisualStudio/feedback/详细信息/724124/wpf-datagrid-with-autogeneratecolumns-shows-nothing
This is in fact 'By Design'. Check http://connect.microsoft.com/VisualStudio/feedback/details/538210/wpf-datagrid-with-autogeneratecolumns-shows-nothingThe issue seems to be fixed in 4.5 and the task got closed.Pls check http://connect.microsoft.com/VisualStudio/feedback/details/724124/wpf-datagrid-with-autogeneratecolumns-shows-nothing