This project is read-only.

Can I just use CODE Framework Theme Engine?

Jun 6, 2014 at 7:41 PM

I am building an application and would like to use the controls and theming from CODE Framework in conjunction with PRISM/MEF for managing views and regions. I've taken my shell which was just a window and I've inherited from the Code.Framework.Wpf.Mvvm.Shell and i've overidden the xaml so that I can place all of my regions inside. (this works if I just inherit from Window). For some reason, the main window shows up but none of the content shows up.

I would like to use the theming and controls from the Code Framework with PRISM & MEF.

Any thoughts?
Jun 12, 2014 at 3:38 PM
Well, that is a very good question :-)

Fundamentally, CODE Framework themes are just XAML resource dictionaries. So you can add a link to those dictionaries from anywhere and get things such as controls that are styled for that theme and so on. Where things get a bit trickier is when you get into the more fundamental things, such as the Shell theme you mention above. There are a few different elements to that. The Shell theme provides a look & feel for the main window (which you should be able to use), but it also styles things such as hosts for views, which are brought in by binding to a view model that provides a list of views. Prism is not going to have that, so you would have to replace that part. Of course this is also where CODE Framework gets really interesting, because it then does things like bind to the actions of the open view(model) to populate menus (or Ribbons, or...). It also populates notifications and message boxes and application status and all that type of stuff that is simply not going to be there in Prism. I am not sure how useful it is at that point to be honest.

Another aspect is that using CODE Framework, one automatically gets additional resource dictionaries loaded with each view. Those can point to their own resources, or they can point to things like standard templates the framework provides. Prism is not going to load those things automatically, but if you could manually load them (and unload and reload them if you want to support theme switching) then you should theoretically get at least some of that benefit.

So in short: While theoretically there should be ways to reuse those resources, it might be tricky in the real world. Them theming is a pretty specific feature CODE Framework supports and there is quite a bit of stuff that goes with it that you would have to provide if you want to use it in other frameworks.