Guest User

Exception when adding a ResourceDictonary at runtime

a guest
Feb 21st, 2012
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  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}" />
Add Comment
Please, Sign In to add comment