我有一個我正在開發的WPF應用程序,它允許用戶切換當前主題。我想出如何switch themes ...但現在看來,該應用程序的背景不受主題:WPF主題不適用於背景
(我混合三張照片一起,以節省空間)
如何我能解決這個問題嗎?它清楚地表明here的背景應該改變...
下面是我使用的代碼:
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>
你可以發佈一些代碼,以便我們可以看到你在做什麼? – evanb 2011-06-03 17:11:21
用代碼 – Entity 2011-06-03 18:12:08