我有一个DataGrid,就DataGrids而言,这非常简单。出于某种原因或其他,头不与其他数据对齐,如图下面的截图:DataGrid列标题不与数据对齐
我在网上搜索,但似乎无法找到它的解决方案。这里是我的DataGrid代码:
Grid>
<DataGrid Name="dgAttributes"
ItemsSource="{Binding itemsSource}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserSortColumns="False"
>
<DataGrid.Columns>
<DataGridTextColumn Width="Auto" IsReadOnly="True" Binding="{Binding Field}" Header="Fields"/>
<DataGridComboBoxColumn Width="95" IsReadOnly="False" Header="Order" ItemsSource="{Binding Source={StaticResource SortOrderProvider}}" SelectedItemBinding="{Binding SortBy, Mode=TwoWay}"/>
<DataGridCheckBoxColumn Width="Auto" IsReadOnly="False" Binding="{Binding GroupBy}" Header="Group By"/>
<DataGridComboBoxColumn Width="85" IsReadOnly="False" Header="Aggregate" ItemsSource="{Binding Source={StaticResource AggregateProvider}}" SelectedItemBinding="{Binding AggregateBy, Mode=TwoWay}"/>
<DataGridTextColumn Width="Auto" IsReadOnly="False" Binding="{Binding Having}" Header="Having"/>
<DataGridTextColumn Width="Auto" IsReadOnly="False" Binding="{Binding DisplayOrder}" Header="Display Order"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
这也可能是值得一提的是,当我点击组合框的细胞之一,头赞同正常。
@Blam你是什么意思? –