问题描述
在WPF中,我正在使用以下简单网格
Hi,
In WPF, I am using simple grid as below
<Grid>
<DataGrid Name="grid1">
<DataGrid.Columns>
<DataGridTextColumn Header="Col1" Width="Auto"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
它生成col1以及一个禁用的额外collumn.我不知道为什么它会生成我尝试使用AutoGeneratese ..属性的额外列,但这不是这里的情况.仍然显示出额外的柱子
实际上,它显示了
----------------------
Col1 | ---------------
----------------------
它应该显示
----------------------
Col1 ------------------
----------------------
在此先感谢:)
It generates col1 as well as an extra collumn which is disabled. I dont know why it is generating an extra collumn I tried with AutoGeneratese.. Property but that is not a case here. Still it shows an extra collumn
Actually, it shows
----------------------
Col1 | ---------------
----------------------
It should show
----------------------
Col1------------------
----------------------
Thanks in advance :)
推荐答案
<DataGridTextColumn Header="Col1" Binding="{Binding Path=Col1}" Width="100*"></DataGridTextColumn>
这篇关于为什么WPF DataGrid显示额外的列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!