I have an application that will have numerous configurations (also can be thought of as a plugin model) - all based on a baseline configuration. So my baseline configuration's Views and ViewModels are location in a root folder inside my project with a Resources.xaml.
Inside this baseline XAML file I have all DataTemplate
s for my baseline product.
Now my thought is that I can create customized configurations or customized offshoots of my main product by using product specific resource files in which I'll be able to specify customized views, customized view models, etc. I think this is a good way of setting this up.
The problem: The problem is that my customized .xaml resource files don't seem to merge theDataTemplate
s specified inside of them into the main resource dictionary. So when I try and load a customized configuration, my baseline views render fine but my customized ones [specified in my product specific resource file] can't see to template
mappings to render views in the application. What am I doing wrong here?
ResourceDictionary productDictionary = Application.LoadComponent(new Uri("CustomUI;component/" + vce.ResourcePath, UriKind.Relative)) as ResourceDictionary;
ResourceDictionary sharedDictionary = Application.LoadComponent(new Uri("CustomUI;component/Shared/View/BaselineResources.xaml", UriKind.Relative)) as ResourceDictionary;
Application.Current.Resources.MergedDictionaries.Add(productDictionary);
Application.Current.Resources.MergedDictionaries.Add(sharedDictionary);