I had problems with the way skins were being referenced in Witty. To solve it, I moved the skins into their own project and needed to load them dynamically. To reference the resources, I use the Pack URI scheme.
Typical you can load the skin resource dictionary with the following pack syntax.
// Load the Resource Dictionary from an external referenced DLL
Uri uri = new Uri("pack://application:,,,/SkinResources;Component/RedSkin.xaml");
Application.Current.Resources.Source = uri;However, I had problems with the previous code in Witty and changed it to:
// Alternate way to load the resource dictionary from an external referenced DLL
Uri resourceLocator = new Uri("SkinResources;Component/GreenSkin.xaml", UriKind.RelativeOrAbsolute);
Application.Current.Resources = Application.LoadComponent(resourceLocator) as ResourceDictionary;
Here's how to refer to the skin resource from XAML.
<Application.Resources>
<ResourceDictionary Source="pack://application:,,,/SkinResources;Component/BlueSkin.xaml"/>
</Application.Resources>
Here's simple solution demonstrating the code above:
Encapsulate Resources source