How do I modify the application button's appearance?

Ribbon for WPF Forum

Posted 15 years ago by Craig - Varigence, Inc.
Version: 4.5.0486
Avatar
I've been struggling to figure out how to change the appearance of the Ribbon's application button. Specifically, I'm looking to change its background gradient, the mouseover highlight color, and the pressed highlight color.

I've been trying to use templates and styles to manipulate these values but my changes are ignored in the designer and at runtime. Additionally, I don't see any samples that demonstrate what XAML is required to change the application button's appearance.

Does anyone know how to make this type of appearance change?

Thanks,

-Craig

Comments (10)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Craig,

RibbonCommonDictionary defines a bunch of static brush keys you can override in an application Resources section.

As an example, if you define this in your app's resources section:
<SolidColorBrush x:Key="{x:Static themes:RibbonCommonDictionary.ApplicationButtonOuterBackgroundNormalBrushKey}" Color="Red" />

You'll find the application button's normal state (the top portion of it for this brush) will be red. Create brush overrides for the other .ApplicationButton* properties and you'll be able to control how it appears for all the states.


Actipro Software Support

Posted 15 years ago by Craig - Varigence, Inc.
Avatar
Works great; thanks for your help.
Posted 14 years ago by Mick
Avatar
How can I change just one part of the theme?

I want to change just the ApplicationButton background color, but it only seems to works when I don't set themes:ThemeManager.Theme="Office2007Blue" in my window. Do I have to re-theme the whole ribbon to achieve this?

Thank you,
Mick
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Mick,

What version of our products are you running and how are you setting the background brush right now?


Actipro Software Support

Posted 14 years ago by Mick
Avatar
I am using version 10.1.520.0, and am following the recommendation of one of the previous posts:

I am using
<SolidColorBrush x:Key="{x:Static themes:RibbonCommonDictionary.ApplicationButtonOuterBackgroundNormalBrushKey}" Color="Red" />
... and so on for all 20 or so brushes that apply to the application button.

However, setting the Office2007Blue theme seems to ignore any of my brushes.

I am also interested in changing the font and font size used in the application button. Hopefully this will be achieved the same way.

Thank you,
Mick
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mick,

When I use the brush resource code you posted, the background of my app button turns red. Please note that that particular brush is now used for the Scenic app button. If you are using the Orb app button, then you'd need to use new brush keys that were specifically added for it in 2010.1.

A resource like this will modify the font:
<Style TargetType="ribbon:ApplicationButton" >
    <Setter Property="FontSize" Value="20" />
</Style>


Actipro Software Support

Posted 14 years ago by Mick
Avatar
I can get the button to turn red as well, but when I set the Office2007Blue theme, it seems to disregard my brush and use the standard blue one.

Is there an order that I have to apply the brush or something I'm not thinking of?

Thank you,
Mick
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mick,

Hmm... well setting the theme like that is bad anyhow. It's better to programmatically set ThemeManager.CurrentTheme = "Office2007Blue" since that will use less overall memory than setting that attached Theme property multiple times. We just include that attached Theme property for testing.

Perhaps if you switch to the app-wide theme setting instead, it will fix it.


Actipro Software Support

Posted 14 years ago by Mick
Avatar
Thank you, that worked.

Is it possible to change the font (and size, color, etc.) for only the ApplicationButton? Changing these properties on the ribbon has the potential to change all items.

Thank you,
Mick
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mick,

Yes, please see one of our previous replies in this thread as it shows you how to change it for the ApplicationButton.


Actipro Software Support

The latest build of this product (v24.1.1) 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.