Button on Customised Toolwindow Header

Docking/MDI for WPF Forum

Posted 8 years ago by Bret Naughton
Version: 11.1.0545
Avatar
Hi,

I am using a custom header for each toolwindow I present to the user - this is created programatically.

What I have done is set a grid with a column for each button/content (Icon/Title/Close Button/etc) I want to see in the header - I then set this grid to be the content of the header.

This works fine. Now, for one of the column elements of this header grid, I am including another grid which is to contain some of the buttons found in the main ribbon menu.

Right now I am setting these up as 'TitleBarButtons' and then setting each of the titlebarbuttons command value to be the same as the main ribbon-bar calls.

This works fine, however, I want to be able to use the idea that if a ribbon bar button is not enabled (through Execute/CanExecute) then the button in the toolwindow header does the same.

My question is, should I be using TitleBarButtons if this is the case, or is there a way of including ribbon menu/buttons as content in my header/grid, so that everything is working in a uniform way without any duplication of logic to enable/disable buttons.

Thanks

[Modified at 08/08/2011 04:52 AM]

Comments (4)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

I'm not really clear on your question. But as long as you are using RoutedCommand (or just an ICommand), then the logic should be shared regardless of what button uses the command.

Using TitleBarButtons gives you a look that matches the other buttons, if you dropped in Ribbon buttons then you'd have to style them to match. But if I'm understanding your question correctly, then using RoutedCommands should be sufficent.


Actipro Software Support

Posted 8 years ago by Bret Naughton
Avatar
Thanks that is exactly what I meant.

This all works fine, the one thing that does not seem to reflect between the ribbon bar button and the Titlebarbutton is - if the ribbon button/RibbonCommand does not pass the 'CanExecute' routine, then it is greyed out... however in the case of the corresponding titlebarbutton this is not reflected, i.e. the button cannot be pressed but is still vivid/activated. Is there any way to automatically have the titlebarbutton 'greyout'/deactivate when the 'CanExecute' is false.

Bret
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

The default Style for the TitleBarButton does include triggers to give it a different look when disabled. If you are setting Background, BorderBrush, or Foreground then those would prevent those triggers from taking affect.

If that doesn't help please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

Posted 8 years ago by Bret Naughton
Avatar
Thanks, this is now resolved. I had not added an event within my button class (inheriting TitleBarButton) to check if active or not, and then set the opacity as required.

Thanks again,
Bret
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.