Link to home
Start Free TrialLog in
Avatar of JElster
JElsterFlag for United States of America

asked on

WPF - How do I programmatically add a resource dictionary

Hi..
How can I programmatically add the following resource dictionary to my C# code?

   <ResourceDictionary Source="/PresentationFramework.Aero;component/themes/aero.normalcolor.xaml"/>
Avatar of Navneet Hegde
Navneet Hegde
Flag of United States of America image

Avatar of saragani
saragani

ResourceDictionary resourceDictionary = new ResourceDictionary();
                resourceDictionary .Source = new Uri
("/PresentationFramework.Aero;component/themes/aero.normalcolor.xaml", UriKind.Relative);

Now if you want to merge it with your application resources then you do the following:

 Application.Current.Resources.MergedDictionaries.Add(resourceDictionary);
ASKER CERTIFIED SOLUTION
Avatar of saragani
saragani

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial