Dynamically loading resource dictionary files to a wpf application gives an error
I am trying to add a xaml resource file dynamically using the statement, Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("resources/leaf_styles.xaml", UriKind.Relative) }); This is throwing an exception, Cannot locate resource 'resources/leaf_styles.xaml'. I added the leaf_styles.xaml file to the project under resource folder and the BuildAction is set to "Content", CopyAlways is set to True. Still I get this error. Could some one help me out pointing whats wrong?? Additional information - I don't want to embed the xaml file as a resource The