我想在Windows Phone 7中創建自定義應用程序主題,但不幸遇到以下問題:如果我嘗試更改樣式和某些默認顏色,風格正確應用,但由於某種原因,顏色不正確。我的意思是我的新Style使用默認顏色而不是自定義顏色。在WP7中創建自定義應用程序主題時出現問題
下面是我在做什麼:
1.I創建了一個名爲CustomTheme文件夾中有兩個ResourceDictionaries:
Brushes.xaml
Styles.xaml
接下來,我通過這種方式將它們添加到App.xaml中:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CustomTheme/Brushes.xaml"/>
<ResourceDictionary Source="CustomTheme/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
3.之後,我試圖以這種方式使用示例樣式從Styles.xaml:
4.As按預期樣式施加結果(我指的是控件模板被改變)但隨着Brushes.xaml
指定的默認顏色而不是這些,我設法通過我的Styles.xaml文件,而不是在App.xaml中添加Brushes.xaml找到問題的解決方法:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Brushes.xaml"/>
</ResourceDictionary.MergedDictionaries>
我在問一個建議。有沒有更好的解決方案?爲什麼顏色沒有正確合併?