WPF Datagrid仅使用标题数据进行横向滚动 [英] WPF Datagrid horizontal scrolling with only header data
问题描述
我有一个 WPF
Datagrid
,在初始阶段,我将分配100列标题到 Datagrid
,但我无法横向滚动查看所有列标题。
DataGrid
没有任何行, ItemSource
为null。当我只有列标题(没有行)时,如何实现水平滚动。
我将 ItemSource
绑定到DataTable只有列标题,没有行。
在这种情况下如何滚动。
As ArsenMkrt说,这是不可能的。但是,我想你可以在 DataTable
中添加一行,但是之后可以设置相应的 DatagridRow
当您的 DataTable
正在填充实际数据时,只需清除DataTable.Rows。 / p>
I have a WPF
Datagrid
, at initial stage i will assign 100 column header to Datagrid
, but I am not able to horizontal scroll it to view all column headers.
DataGrid
does not have any rows, ItemSource
is null. How do I achieve horizontal scrolling when I have only column headers (no rows).
I binded ItemSource
to a DataTable which has only column header and no rows.
How can I scroll in this scenario.
As ArsenMkrt said, it is not possible. But, I think you can add a row to your DataTable
but after that, you can set its corresponding DatagridRow
's Visibility to be Hidden.
When your DataTable
is being populated with actual data, just clear DataTable.Rows.
这篇关于WPF Datagrid仅使用标题数据进行横向滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!