Ribbon tint hides my App.xaml resources?

Ribbon for WPF Forum

Posted 12 years ago by Craig Presti
Version: 1.0.0345
Avatar
If I apply a custom tint to the ribbon as specified in the documentation it says to do the following to make it work:
RibbonColorScheme.Default = new RibbonColorScheme("TanColorScheme", 
    RibbonColorSchemeType.Office2007Silver, Colors.Tan);
Uri uri = new Uri("/ActiproSoftware.Ribbon.WPF30;component/Themes/Brushes.xaml", UriKind.Relative);
ResourceDictionary resourceDictionary = (ResourceDictionary)System.Windows.Application.LoadComponent(uri);
System.Windows.Application.Current.Resources = resourceDictionary;
This is fine and worked as described...but my application now crashes at runtime trying to dynamically access resources I had predefined in my App.xaml - because it can no longer find them. I've tried adding the Brushes.xaml into the MergedDictionaries collection which fixes my runtime crashes but prevents the tint from working.

Any ideas?

[Modified at 06/22/2007 12:08 AM]

Comments (2)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If you replace the last line with this, it should work:
System.Windows.Application.Current.Resources.MergedDictionaries.Add(resourceDictionary);
I just tested it in the sample project by adding an app style for TextBlocks that set their backgrounds to red and making the code change above. It did the trick and worked well. However if you will be changing the theme more than once, you'll probably want to remove any old instance of the brushes in the merged dictionaries before adding a new one since otherwise they will start to pile up.


Actipro Software Support

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Just FYI, we've updated the docs for the next maintenance release to reflect this information and provide a little more.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.