Tuesday, September 21, 2010

Best Practices for Themes in Modular Silverlight Applications

When building large Silverlight applications, it makes sense to build sets of styles that can be shared across the application. Many examples on the web illustrate placing these in the App.xaml file and then you are off to the races. Unfortunately, when you are building modular applications, it's not that simple. The dependent modules still require design-time friendly views, and to make that happen requires a few steps.
The Central Theme
  The first step is to take your theme for the application and place it in a separate project. These are themes that only have dependencies on the core Silverlight controls. What you want is a simple project that any application or module can reference to pull in the theme.
Create a new Silverlight class library, then add a ResourceDictionary to house your themes.
Read more: C#er: IMage