Chapter 8 Styles
8.3 Using Styles for Good, Not Evil
8.3.1 Build Themes, Not Styles
Consequently, generally the best practice is to think of a theme as a “thing” rather than just a collection of styles at the root window in the application.
The first piece of concrete advice I would give is to move the definition of the theme into a separate file and use the merged-dictionaries feature to bind the theme into the application. Even better, move the theme definition to a separate assembly and use a cross-assembly reference to load the style (/<assemblyName>;component/<resourceName>):
8.3.2 Consistency Is King
When building a custom look and feel for an application, it is important to make it consistent across all the controls that will be used.
One of the goals of WPF was to make every control customizable so that we wouldn’t get the “Frankenstein” applications often seen with older forms packages (appearing as if the UI had been stitched together using parts of other applications).
8.3.3 Have a Point
Custom themes allow us to differentiate one application from others. Creating a custom theme is potentially expensive, in terms of both design and implementation.
The key thing is that a custom theme should convey something to the user.
本文探讨了使用WPF创建一致且具有目标性的自定义主题的重要性。强调了将主题视为整体而非仅样式集合的方法,并介绍了如何通过分离文件和跨程序集引用实现这一目标。此外,还讨论了保持用户界面一致性及传达应用程序独特特性的策略。

被折叠的 条评论
为什么被折叠?



