In the process of developing Family.Show, I noticed that we were starting to create lots of XAML resources such as brushes, styles, and data templates. My thinking at the time was to separate the resources into separate files organized by functional type to make them easier to find. For example, all SolidColorBrushes and LinearGradientBrushes would go into BrushResources.xaml. To use the resources as a group, we simply use the WPF Merged Resource Dictionaries feature. (At the time, Paul Stovell also recommended separating resources into the own files. http://paulstovell.net/blog/index.php/xaml-and-wpf-coding-guidelines/)
Separating the resources made a lot of sense from a developer perspective. It keep any particular resource dictionary small and simple. By using the solution explorer in Visual Studio, I can quickly find and edit the resources that I want.
Separate Files Added Complexity To Skinning
I started running into issues when we adding the skinning feature to Family.Show. For the new Silver skin, we needed to replicate the the same resource dictionary files for each skin. This added complexity as the number of files was doubled. In Visual Studio, it was still clear and easy to find resources as they are organized by folder.
The problem was that many of the skin changes were typical easier to modify in Expression Blend using the Resources panel. However, Blend displays the resources like the screenshot below. This made it really difficult to find the right resource for the right skin to change it.
Another problem was that any change made to the skin would take awhile to be displayed in the Blend designer, slowing down the skinning process.
Single Resource Dictionary for Skin
In developing Witty, I went a different route with resource organization by keeping all resources in a single file, in a similar fashion as cascading style sheets mostly being single files. This really simplified the resources. In addition any resource changes were quickly displayed in the designer. Although the number of resources in Witty is smaller, I think Blend is just more performant with less Merged Dictionaries.
Based on my WPF project experiences, I would advocate placing resource dictionaries into a single resource dictionary, especially if skinning is involved.
What do you think? Should XAML resources be organized into separate files or a main single file? I would love to hear your thoughts on this.