自定义主题的最佳实践
为 WP7 应用程序自定义主题(字体系列、颜色等)的最佳实践是什么?我应该坚持使用标准名称 并替换它们或创建新的资源名称并使用它们?
IE。 “PhoneFontFamilyNormal”还是“MyAppFontFamilyNormal”? “PhoneTextNormalStyle”还是“MyAppTextNormalStyle”?
关于该主题的文档似乎即使支持自定义主题(如果不建议的话),也只专注于玩正向和反向游戏。
What are the best practices for customizing themes for a WP7 application (font family, colours, etc)? Should I be sticking to the standard names and replacing them or creating new resource names and using those?
ie. "PhoneFontFamilyNormal" or "MyAppFontFamilyNormal"? "PhoneTextNormalStyle" or "MyAppTextNormalStyle"?
The documentation on the subject seems to focus soley on playing the straight and norrow, even though custom themes are supported (if disueded).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会亲自创建具有独特名称的自己的资源并使用它们。这避免了与优先级相关的任何混乱(我现在不记得 Silverlight 中的资源查找机制,我知道它是 WPF 的简化 - 这有点复杂!)。
一个重要的考虑因素是您是否支持深色/浅色主题。标准主题资源(例如
PhoneBackgroundBrush
)将遵循用户主题。因此,如果您希望支持深色/浅色,我建议您从标准主题派生您自己的主题,例如,您可以从PhoneBackgroundColor
派生背景画笔。I would personally create my own resources with unique names and use those. This avoids any confusion relating to precedence (I can't recall right now the resource look-up mechanism in Silverlight, I know that it is a simplification of the WPF one - which is a little complex!).
One important consideration is whether you will support dark / light themes. The standard theme resources like
PhoneBackgroundBrush
will honour the users theme. Therefore, if you wish to support Dark / Light I would recommend deriving your own theme from the standard one, for example, you might derive your background brush fromPhoneBackgroundColor
.