WPF工具包Datagrid标头和空源 [英] WPF Toolkit Datagrid Headers and Empty Source

查看:93
本文介绍了WPF工具包Datagrid标头和空源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在没有行要显示的情况下,如何使Datagrid显示标题?

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

我的Datagrid完全只读为:

My Datagrid is "completely" read-only with:

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

"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!

全力以赴

Fred

推荐答案

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标头和空源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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