Jun 11, 2008 at 1:53 PM
Edited Jun 11, 2008 at 2:26 PM
Hi 2 all!
I got a little problem: i'm using system.addin framework in my application and each of addins has a GetResourceDictionary() method.
So when i'm executing thes method, i have an exception "ResourceDictionary is not marked as serialized"...so the question is how to pass my ResourceDictionary with custom visual style to the host app?
I tried to use CopyTo method of ResourceDictionary class, but it doesn't copy merged dictionaries.
Another problem is that when I try to make a ResourceDictionary inside addin with the code shown below, I have another exception- The URI prefix is not recognized when attempting to assign uri to the Source property of ResourceDictionary:
Uri uri = new Uri("/MyAddin;component/Theme.xaml", UriKind.Relative);
m_Resources = new ResourceDictionary();
m_Resources.Source = uri;
The question is: What is wrong?
Since ResourceDictionary is not serializable, you will need to define contracts, views and adapters to pass it across the appdomain/process boundary. To verify that the types you are using in contracts are safe to pass across appdomains/processes, you can run
the FxCop rules (http://www.codeplex.com/clraddins/Wiki/View.aspx?title=Add-in%20FxCop%20Rules)