Recently Tim Heuer has launched several “themes” for Silverlight, you can read about them in http://timheuer.com/blog/archive/2010/05/03/new-silverlight-4-themes-available-for-download.aspx and http://timheuer.com/blog/archive/2010/05/17/silverlight-4-tools-released-and-new-application-templates.aspx.
This announcement has been done along with the launch of the Silverlight tools for Visual Studio 2010. Although this news was overwhelmed by the tools announcement, I think is very interesting since they are defining (or at least proposing) a standard for the definition of a complete theme structure for Silverllight …
We have been expecting a sample like this, because it is shows clearly the purpose of Silverlight & WPF for separating the Designer and Developer concerns and enables to showcase Blend as an efficient designer tool: Disconnect the interaction between the designer and on the part associated with the developer.
This separation of concerns was improved greatly with the appearance of behaviors in Blend 3.0 and Silverlight and now is better with improved support for Blend 4.0 (beta) and SL 4.0.
For now, the way to “handle” all this themes is to manually place a series of files in a folder of “Assets” which if done right includes various styles files, resource libraries, behaviors – see http://storage.timheuer .com/newthemes-structure1.png for a clearer picture – also this themes can incorporate any Font, image or video, according to the style in question.
This in itself is rather large achievement as we can decouple the interaction of styles and is relatively simple …. for a Developer … for a “pure” designer this is complex and costs understanding and concentration…
I am proposing an evolution of this already great proposal, to make it greater..this is to further simplify the interaction model for the themes which enables to create and work on them separately, uncoupling them from the application, assigning them its own “theme” project type, like “cosmopolitan.theme.dll” wich is nothing else than a Silverlight class library with a assigned dll.
This way, a designer can create a theme library like “Cosmopolitan.theme.dll”and the application can change the theme at any time using the theme dll without the need of having to delete files of styles, behaviors, images, fonts, etc … (which costs time and is prone to errors).
This also enables to have several associated themes and change them as we want through code or, better, a behavior.
There are some clear advantages of my proposal:
- The designer can abstract from the complexity of the application and focus only on the design of the theme and its styles.
- The designer avoids touching any code sensitive for the developer, even accidentally – favoring the separation and decoupling.
- We favor a potential marketplace for “themes” for Silverlight. If I want to sell themes, it would be good that the technology supports them as separate beings.
- Promotes the theme reuse for creating other themes, thus stimulating creativity and competitiveness “between designers (and also some developers).
- It will make very visible at last the advantage of Blend and Silverlight to fully decouple the visual aspect and interaction with the application development. (Very necessary).
On the other hand is very easy to set up a generic test project in which multiple pages are displayed that showcases all controls, SL controls, SDK controls, graphics, Toolkit controls as well as it would be easy to add our own controls dynamically. .. This would make wonderfully simple for the designer to test his theme very easily…
And, as a firm petition, this would be fantastic if this was enabled into Silvelright and it integrated on Blend
On the other hand, the type of proposed type of dll “theme.dll” is that of a normal Silverlight class library, it would be easy to make a “base template project” with implementations of all controls by default. This would mean to only change or add a template to these themes dll’s… and modify the existing ones to allow dynamic loading and unloading based directory Assets, for instance). MEF we would allow to do this very easily ..
How do you see this? If you think this is a good idea, please vote for it on the Silverlight feature request! Let’s help everybody to make this technology a huge success!
The link to vote : http://dotnet.uservoice.com/forums/4325-silverlight-feature-suggestions/suggestions/793999-support-for-theme-projects-dynamic-theme-switchi
Or suggest how would you focus this? I am eager to read your suggestions and construct together what would be the best implementation for a native theme support for Silverlight.