Hi,
I'm experimenting with changing colors in the new Office 2013 theme in version 14.1. I'm using the Infragistics Color Tuner from within Visual Studio.
For most controls, everything works as expected, but the Ribbon does not seem to act upon changes to the colors. The attached zip file shows two examples of the Ribbon being 'washed' with a green color.
As the ribbon1.jpg image shows, the Ribbon still uses the default blue base color.
The ribbon2.jpg shows another strage effect in that parts of the ComboEditorTool uses the default, blue color while other parts (the expanded part) uses the green color I supplied.
In addition to making modifications to my existing application I also tried this on a simple sample application, but with the same effect; The ribbon is not correctly 'washed' with the changed colors. Are the changes made by the Infragistics Color Tuner not sufficient for modifying the Ribbon, and are additional steps required ? What am I doing wrong ?
Regards,Leif
Hi Leif,
It's hard for me to tell from your images exactly how you are incorporating the ResourceWasher into you application.
There is a very good sample in the Feature Browser to give you some idea about the impact of using the washer. Look in the XamRibbon in the Style section for Live ResourceWasher. It allows you to change the base theme and the WashMode as well as change the single wash color you are using.
I took a xamRibbon sample that I have and removed any reference to Theme on the controls. Then I added the ResourceWasher to the Application’s ResourceDictionary in MergedDictionaries.
You need to add a namespace to your app.xaml file for the Themes.
xmlns:igThemes=http://infragistics.com/Themes
Then you can add the ResourceWasher and modify as you need.
<ResourceDictionary.MergedDictionaries>
<igThemes:RibbonOffice2013 />
<igThemes:ResourceWasher AutoWash="True" WashColor="#FF76923C" WashMode="HueSaturationReplacement" >
<igThemes:ResourceWasher.SourceDictionary>
<igThemes:RibbonWashBaseLight />
</igThemes:ResourceWasher.SourceDictionary>
</igThemes:ResourceWasher>
</ResourceDictionary.MergedDictionaries>
Please let me know if you have any questions.
your sample helped me. It looks like my error was caused by the fact that I also explicitly set the Ribbon's theme in XAML, e.g. specifying Theme="Office2013" in the XamRibbon XAML element. Removing this XAML attribute makes the colors look as expected.
However, removing the 'Theme' attribute from the XAML and using the resource washed theme instead, now gives another issue: I'm using custom code to add an item to the Ribbon's context menu. The code to do this is called from the Ribbon's 'Loaded' event handler, and basically look like this:
var contextStyle = this.ribbon.FindResource(typeof(RibbonContextMenu)) as Style;if (contextStyle == null){ return;}contextStyle.Setters.Add(new EventSetter{ Event = ContextMenu.OpenedEvent, Handler = new RoutedEventHandler(this.ContextMenuOpened)});
The 'ContextMenuOpened method does the actual adding of the menu item.
Previously, and when Theme="Office2013" was specified for the Ribbon, everything worked fine. Now, after removing the 'Theme' attribute and using the resource washing feature, I get an InvalidOperationException in the code above, when calling the 'Setters.Add' method. The additional message of the exception is:"After a SetterBaseCollection is in use (sealed) it cannot be modified".
Additionally, when I now arrive to this point of code the Setters collection is empty. Previously it had 6 items.
Obviously, using resource washing affects parts of the Ribbon's setup in a way that breaks my code. How can I rewrite my code to make the menu item adding work when using resource washing ?