5

我有一个自动生成列的数据网格。

<DataGrid Name="QueryGrid" AutoGenerateColumns="True" Height="1000" Width="1135" ItemsSource="{Binding QueryTable}" Visibility="{Binding Path=QueryGridVisiblity, Converter={StaticResource BoolToVis}}"  />

我必须使列名加粗。我该怎么做呢?有什么建议么?

问候, 萨加尔

4

2 回答 2

12

这是我找到的答案:

 <DataGrid Name="QueryGrid" AutoGenerateColumns="True" Height="900" Width="1135" ItemsSource="{Binding QueryTable}" Visibility="{Binding Path=QueryGridVisiblity, Converter={StaticResource BoolToVis}}">
                <DataGrid.ColumnHeaderStyle>
                    <Style TargetType="{x:Type DataGridColumnHeader}">
                        <Setter Property="FontWeight" Value="Bold"/>
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                    </Style>
                </DataGrid.ColumnHeaderStyle>
            </DataGrid>
于 2013-06-19T14:06:53.713 回答
0
<DataGridTextColumn.HeaderStyle>
                    <Style 
                        TargetType="DataGridColumnHeader">
                        <Setter 
                            Property="Background" 
                            Value="SteelBlue"
                            />
                        <Setter 
                            Property="HorizontalContentAlignment" 
                            Value="Center"
                            />
                        <Setter Property="FontSize" Value="17"/>
                        <Setter Property="FontWeight" Value="Bold"/>

                    </Style>
                </DataGridTextColumn.HeaderStyle>
于 2020-01-16T11:19:33.957 回答