WPF themes do not apply to background

I have a WPF application that I am developing that allows the user to switch the current theme. I figured out how to switch themes ... but it seems that the theme of the application is independent of the theme:

enter image description here

(I combined three shots to save space)

How can i fix this? It clearly shows here that the background should change ...

Here is the code I'm using:

MainWindow.xaml:

<Window x:Class="GDE.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" MinWidth="525" MinHeight="350">
    <Grid>
        ....
    </Grid>
</Window>

App.xaml:

<Application x:Class="GDE.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary x:Name="ThemeDictionary">
                    <ResourceDictionary.MergedDictionaries>
                        <ResourceDictionary Source="/Themes/ExpressionDark.xaml"/>
                    </ResourceDictionary.MergedDictionaries>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
+3
source share
2 answers

Themes define the background, but you need to configure it yourself, since it does not link anywhere inside the theme:

Background="{DynamicResource WindowBackgroundBrush}"

? , , , TargetType Window, , Window, . MainWindow.

+6

, , , , , .

0

All Articles