Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Exception when adding a ResourceDictonary at runtime

By: a guest on Feb 21st, 2012  |  syntax: None  |  size: 0.58 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var dictionaries = Resources.MergedDictionaries;
  2. dictionaries.Clear();
  3. string source = String.Format("/CommonUI;component/Resources/{0}.xaml", value == AppStyleSet.Light ? "WP7Style_Light" : "WP7Style_Dark");
  4. //base styles
  5. var themeStyles = new ResourceDictionary {Source = new Uri(source, UriKind.Relative)};
  6. dictionaries.Add(themeStyles);
  7. var generalStyles = new ResourceDictionary();
  8. generalStyles.Source = new Uri("/CommonUI;component/Resources/Styles.xaml",UriKind.Relative);
  9. dictionaries.Add(generalStyles);
  10.        
  11. ... <Setter Property="Color" Value="{StaticResource HighlightColor}" />