覆盖默认主题WP7的自定义主题
|
是否可以创建自定义主题并将其用作默认主题?
我在任何地方都能找到的每个示例都说,您可以通过复制
ThemeResources.xaml
和System.Windows.xaml
文件并将其作为合并的词典包含在应用程序中来创建自定义主题。
http://windowsphonegeek.com/articles/Creating-WP7-Custom-Theme-ndash-Basic-Theme-Implementation
Windows Phone 7中的替代主题
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=\"Resources/CustomThemeResources.xaml\" />
<ResourceDictionary Source=\"Resources/CustomThemeStyles.xaml\" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
然后,我读了一些更多的文章,您需要在样式文件中包括画笔,因此在CustomThemeStyles.xaml
中我有这个。
http://www.windowsphonegeek.com/articles/Creating-WP7-Custom-Theme---Complex-Theme
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=\"CustomThemeResources.xaml\" />
</ResourceDictionary.MergedDictionaries>
它无法正常工作...所以我下载了示例应用程序,果然,每个想要更改颜色(例如背景色)的页面都将在其最外面的组件上进行设置。
<Grid Background=\"{StaticResource PhoneBackgroundBrush}\">
...
</Grid>
是否可以包含可更改所有默认设置的样式/画笔/颜色/等的自定义主题,而不必在任何地方都进行显式设置?
没有找到相关结果
已邀请:
3 个回复
钨蜡唤喉晤
恋卡
从理论上讲,这应该足够了,但不幸的是,这还不够。由于某些原因(希望是芒果更新中已修复的错误),您还需要在Custom.xaml中包含Reset.xaml,如下所示:
完成此操作后,应该就可以了。您不需要做任何其他事情。
辟官陡板休
希望在WP8 SDK中,我们不再需要执行此解决方法。