Dynamically loading resource dictionary files to a wpf application gives an error

At last, it worked. Here is what I did,

  1. Went thru’ http://msdn.microsoft.com/en-us/library/aa970069.aspx.
  2. Changed the Uri pattern to

    var foo = new Uri("pack://siteoforigin:,,,/resources/leaf_styles.xaml", UriKind.RelativeOrAbsolute);
    Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = foo });
    

Leave a Comment