Increase FontSize and FontWeight of DataGridColumnHeader of a WPF dataGrid in Visual Studio 2017

219 views Asked by At

The FontWeight of my DataGridColumnHeader is fine while developing in visual studio 2017 but once I launch the project, the text for the DataGridColumnHeader becomes faded. This is the same for the DataGridComboBoxColumn. TextColumns work fine though. I found online that the best way to solve this problem is to use a TextBlock in the place of the DataGridColumnHeaderPresenter in the style of the DataGrid but I can't find any help on how to achieve that.

Also, no matter how much I increase the fontsize for the DataGridColumnHeader and the DataGridComboBoxColumn, it doesn't seem to change. I know some developers will suggest that I should add the following fragment to my DataGrid.

<DataGrid.Resources>
       <Style TargetType="{x:Type DataGridColumnHeader}">
             <Setter Property="FontWeight" Value="Bold" />   
             <Setter Property="FontSize" Value="26" />
       </Style>

        <Style TargetType="{x:Type DataGrid}">
             <Setter Property="FontWeight" Value="Bold" />   
             <Setter Property="FontSize" Value="26" />
       </Style>
    </DataGrid.Resources>

I have tried adding that but it doesn't work. I have edited the Template for the DataGrid, DataGridColumnHeader etc but no luck.

0

There are 0 answers