Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the FontSize and style of the data header in my xaml Datagrid

I have a datagrid which auto generates the columns.

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

I have to make the column names bold. How do i do this? Any suggestions?

Regards, Sagar

like image 955
voonna Avatar asked Jun 19 '13 13:06

voonna


1 Answers

Here is the answer i have found:

 <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>
like image 180
voonna Avatar answered Nov 09 '22 17:11

voonna