DataGridTextColumn foreground [Theme Resoruce] does not change in dark mode

48 Views Asked by At

Using "ThemeResource" I want to change the foreground depending on whether it is in light mode or dark mode

But it only works in Light mode, in dark mode use the default color

DataGridTextColumn

<controls:DataGridTextColumn.CellStyle>
  <Style TargetType="controls:DataGridCell">
      <Setter Property="Foreground" Value="{ThemeResource GrayTextColor}" />
  </Style>
</controls:DataGridTextColumn.CellStyle>

App.xaml

<ResourceDictionary x:Key="Light">
                  <SolidColorBrush x:Key="GrayTextColor" Color="#99000000" />
              </ResourceDictionary>

<ResourceDictionary x:Key="Dark">
                  <SolidColorBrush x:Key="GrayTextColor" Color="#99FFFFFF" />
              </ResourceDictionary>

I've already tried "white" / "black" and opacity 0.6, but it doesn't work either

0

There are 0 best solutions below