What's the recommended way to expose standard colors in WPF
I would normally just create a static class like StandardFoo开发者_StackOverflow社区Colors and create a static field for each standard color. However, with WPF I could also put these in a resource dictionary. Just wondering if there is a recommended way to do this or if it is 6 of 1 or half dozen of the other?
I suggest you use a ResourceDictionary. This will also give you the option to associate color (xaml) files with different "skins", and easily switch between them on-the-fly.
Plus, it is easier to define complex colors and brushes in xaml than it is in code.
精彩评论