You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
自从3.0升级到3.2后发现用到DataGrid的地方,当ItemSource.Count=0时,DataGrid不会显示ColumnHeader,翻看了其模板后发现是特意这么改的。判断逻辑为当HasItem=False,即没有数据的时候显示的是hc:Empty,如下。
Activity
ghost1372 commentedon Jul 8, 2021
First, please type in English
Second, if you want to display hc:Empty, you need to set up an AttachedProperty
hc:Empty.ShowEmpty="true"for the datagrid.also if you need to use hc:Empty in another way again you should set
hc:Empty.ShowEmpty="true"please read docs
lwqwag commentedon Jul 30, 2021
I found a issue when set DataGridTextColumn Width="*“ the header not visible when data is empty as blow code.
<DataGrid hc:Empty.ShowEmpty="True" AutoGenerateColumns="False" CanUserAddRows="False" CanUserSortColumns="False" HeadersVisibility="All" ItemsSource="{Binding TestData}"> <DataGrid.Columns> <DataGridTextColumn Width="*" Header="TEST1" /> <DataGridTextColumn Width="*" Header="TEST2" /> <DataGridTextColumn Width="*" Header="TEST3" /> <DataGridTextColumn Width="*" Header="TEST4" /> </DataGrid.Columns> </DataGrid>ObservableCollection<Class> TestData=new ();fixed HandyOrg#903