Change keyboard shortcut for ToggleMinimization

Ribbon for WPF Forum

Posted 10 months ago by rex hui
Version: 18.1.0674
Avatar

CurrentlyToggleMinimization is defined as Ctrl-F1, how do I change it to something else?

Thanks.

Comments (12)

Posted 10 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We attach to the containing Window's PreviewKeyDown event and watch for that key shortcut.  If the Ribbon.IsMinimizable property is true, it will toggle the Ribbon.IsMinimized state.  The reason we have that key shortcut hard-coded is that the official Microsoft specifications for ribbons require Ctrl+F1 to toggle minimization if minimization is used.

There isn't a way at the moment to alter that key sequence, nor should you since it is a common key shortcut that is used across all Microsoft ribbons (Office, Windows Explorer, etc.).

You could use Shift+F1 or Ctrl+Shift+F1 for your other needs instead.


Actipro Software Support

Posted 10 months ago by rex hui
Avatar

I understand this is windows standard but our software must allow users to remap any key combinations to send different data to the host or perform different functions. Ctrl-F1 in our case by default will send certain data to the host. We will allow user to map it to other things they wish such as toggle the ribbon but it has to be configurable. 

Posted 10 months ago by Stefan Koell
Avatar

I think I will soon face the same issue. My users should also be able to remap shortcuts. Any chance keyboard shortcuts could be made customizable?

Answer - Posted 10 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Ok we will update Ribbon logic for the next build (675 or later) so that you can do this sort of thing to set Ctrl+Shift+M for instance:

RibbonCommands.ToggleMinimization.InputGestures.Clear();
RibbonCommands.ToggleMinimization.InputGestures.Add(new KeyGesture(Key.M, ModifierKeys.Control | ModifierKeys.Shift));


Actipro Software Support

Posted 10 months ago by rex hui
Avatar

Thank you. Since the latest maintenance release was just released, the next one may be a few months from now? Will you be able to provide a build for us now?

Posted 10 months ago by rex hui
Avatar

Just realized similar issue for the Ctrl-F6, Ctrl-Shift-F6, and Ctrl-F4. Need to be able to override those too.

[Modified 10 months ago]

Posted 10 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rex,

How would you ideally like to be able to specify those particular keyboard shortcuts for Docking/MDI?  There are related commands on DockSite for them but those commands are DelegateCommand instances, so they don't have an InputGestures property on them.


Actipro Software Support

Posted 10 months ago by rex hui
Avatar

Probably just a way to turn them off If they can’t be changed. 

Posted 10 months ago by Stefan Koell
Avatar

Can the commands with the keyboard shortcuts also be executed by code? If so, disabling the built-in shortcuts and handing it off to the application to handle them would be the best approach I guess...

Posted 10 months ago by rex hui
Avatar

Those are just activating the next/previous document and closing the document so they can already be executed by code. 

So all I need is a way to disable all hard coded keyboard shortcuts. 

Answer - Posted 10 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

For the next build, we have added a virtual DockSite.ProcessDockHostKeyDown method that is called when a key is pressed while focus is within a DockHost.  It's a method we had internally before.  You'll be able to override that and block the base method call if you detect one of those three key sequences you mentioned.  You should still call it for all others though since it is responsible for handling Esc key presses and passing hotkeys to the Switcher as well.

And yes, you can programmatically call the DockSite.ActivateNextDocument, ActivatePreviousDocument, and ClosePrimaryDocument methods.  Or you can execute their related commands.

If you'd like a preview build, please write our support address and mention this thread.  We can send you a link from there.


Actipro Software Support

Posted 10 months ago by rex hui
Avatar

Perfect! Thank you very much. 

The latest build of this product (v2019.1 build 0683) was released 12 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.