CanDocumentWindowsRaft and Ribbon Commands

Docking/MDI for WPF Forum

Posted 6 years ago by Valéry Sablonnière - Staubli
Version: 13.2.0590
Avatar

Hello,

I'm using a RibbonWindow with Docking and the CanDocumentWindowsRaft property set to true.

If the document window is becoming floating, the document window loses the focus when I click on a button of a ribbon, and the command becomes disabled.

So it seems impossible to execute a command in a ribbon when a document window is in the floating state.

What did I miss ?

Best regards.

Comments (5)

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

Hello, this is a problem in general with using routed commands in multiple top-level WPF Window objects.  Please see this post for more information.


Actipro Software Support

Posted 6 years ago by Valéry Sablonnière - Staubli
Avatar

Yes, I saw this post, and I already use the DelegateCommand solution.

The problem is that my handler of this command is using the ActiveWindow of the DockSite, and in this case the floating window is no more active, and the command becomes disabled.

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

Ah, I see.  Yes that is a general WPF issue as well.  There is a workaround posted on this thread in StackOverflow.


Actipro Software Support

Posted 6 years ago by Valéry Sablonnière - Staubli
Avatar

OK thanks for the interesting article!!

I tried this:

static App()
{
    HwndSource.DefaultAcquireHwndFocusInMenuMode = false;
    Keyboard.DefaultRestoreFocusMode = RestoreFocusMode.None;
}

 And I was happy to see that my DocumentWindow was still active when I clicked on a button of the ribbon, but...

.. a lot of weird bugs happens, but it seems to come from the Ribbon control.

 

So I created a Sample with a menu and 2 controls: 1 TextBox in WPF and 1 in WinForms in a WindowsFormsHost.

And I display the state of the InputManager.Current.IsInMenuMode property.

When I click on a menu, the IsInMenuMode is set to true, and when the command is executed the IsMenuMode is set back to false and everything is OK, the focus is not stolen by my menu, the command is executed and the focus is still in the TextBox (WPF and WinForms) => GREAT.

Then I changed my menu with a Ribbon, I don't know if it is the reason of the bug but the IsMenuMode seems to be stuck to true.

I think I should ask this in the Ribbon forum, no ?

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

Hello, maybe you could send a simple sample project showing the issue to our support address and reference this thread.  Be sure to rename any .zip file extension so it doesn't get spam blocked.  Thanks!


Actipro Software Support

The latest build of this product (v2019.1 build 0681) 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.