views:

194

answers:

1

Hi,

I have a PRISM based silverlight solution under source control. In regards to theming I have a project for each theme, for example 'Theme_Summer', 'Theme_Winter' projects. In reality there may be over 30 of these theme projects. Each theme project contains a selection of resource dictionaries to hold the styles etc along with the images, sounds etc that are required.

Each of these projects also has a Main.xaml merged resource dictionary that ties together all the resources in that theme project. My main application then just uses the Main.xaml resource dictionary from whatever theme project it needs to use.

The problem I have is I need these 30 or so themes in my solution so they remain under source control and manageable but they all get compiled into the XAP which is obviously not good as the app gets deployed somewhere and only requires 1 theme.

My question is really what do people think would be a suitable approach? Having a seperate solution for each theme so that it gets compiled into a seperate XAP and loaded dynamically seems like a lot of work. Is there a way to externally load these while they are part of the same solution?

Thanks for your time

+1  A: 

Disclaimer: What I am recommending may not be the best for you. I only know a tiny bit about your project and know nothing about what you have told the customer (or boss) what you would deliver them.

If you are going to have x (where x is between 2 and 30-ish) themes. You will probably want to spend some time building a framework for supporting x themes. Since you won't want to change this framework every time you add a new theme, PRISM is perfect for you.

I would move everything out into x-ish silverlight class libraries. Obviously you could package similar themes together, like Seasons or Holidays, which would widdle down on the numbers of projects. Now don't forget that your Visual Studio Solution can have more than one project in it (Simply right click on the project and select Add->New Project).

Using PRISM is rather simple and there are a lot of resources to help you dynamically load xap files. It sounds like you may eventually want to rid yourself of problems associated with compiling in a bunch of similar logic.

Is there a way to externally load these while they are part of the same solution?

The answer is yes! You will have to compile your individual silverlight applications into XAP files and load them with PRISM.

It may seem like a lot of work, but when you've created the first few of them, it becomes second nature and really simple to add more XAP's to your list.

http://development-guides.silverbaylabs.org/Video/Silverlight-Prism

http://msdn.microsoft.com/en-us/magazine/dd943055.aspx

http://www.sparklingclient.com/prism-silverlight/

Jeremiah
Hi Jeremiah,Thanks for that, the links looks really useful, especially the section in the MS article about how easy it is to load external .xaps. Somehow managed to miss that before..Thanks again
Suiva