Ribbon for WPF Forum

Posted 6 years ago by Bjørnar Sundsbø - Norway
Version: 17.2.0665

In the Sample application, there is a Metro-Style Window example for injecting a quick launch kind of box into the title bar. This is what I want to do, but I would like to keep the rest of the title bar as is. Is there an easy way to accomplish this without having to retemplate the entire title?

Also, if you have any suggestion an an easy way to change the background color of the title area without too much trouble, that would be great. The situation is similar to Visual Studio and the notification area, but I would also like to change the color of the title bar to attract focus from the user. At least to try it out to see how it works. 

Bjørnar Sundsbø

Comments (1)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA


The Metro-Style Window demo in the Themes area shows how WindowChrome can add any content to the title bar, keeping the rest of the title bar as-is.  RibbonWindow (I assume that's what you mean here) does use WindowChrome behind the scenes, but you can't declare another instance in XAML like you can in that demo since that would wipe out the internal one we use.  Instead you'd have to call WindowChrome.GetChrome(window) in the window's constructor after InitializeComponent.  Then you could programmatically set its chrome.TitleBarContentTemplate property to a DataTemplate you grab from Resources and that will let you add custom title bar content to RibbonWindow.

Title bar backgrounds are done like this in the RibbonWindow template:

{DynamicResource {x:Static themes:AssetResourceKeys.WindowTitleBarBackgroundActiveBrushKey}}

If the window is inactive, it uses the WindowTitleBarBackgroundInactiveBrushKey resource instead.  To alter those, you could probably place new values for those resources in your window's Resources.  Since they are referenced with a DynamicResource, the new values should flow down.

Actipro Software Support

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