WPF Extended Toolkit PropertyGrid: Change font col

2019-09-14 05:00发布

问题:

I am using the WPF Extended Toolkit PropertyGrid in a WPF app which also uses MahApps.

I have set the application theme to BaseDark.

When I display PropertyGrid, the text in the first column of the grid and in the Search textbox is white on a white background.

I would like to change the Foreground color of this text to black.

I have tried applying this Foreground color to various target controls (i.e. TextBlock, TextBox, DataGridCell) in PropertyGrid.Resources.Style but this has not changed these particular texts.

What should I do to achieve this?

回答1:

You can find the appropriate Keys in the MahApps Colors section, TargetTypes through elimination

<pg:PropertyGrid.Resources>
    <!--TextBox-->
    <SolidColorBrush x:Key="TextBrush" Color="Black" />
    <!--Label-->
    <SolidColorBrush x:Key="LabelTextBrush" Color="Black" />
    <!--TextBlock-->
    <SolidColorBrush x:Key="BlackBrush" Color="Black" />
<pg:PropertyGrid.Resources/>