Execute routing commands by specifying a floating document as CommandTarget

Docking/MDI for WPF Forum

The latest build of this product (v24.1.2) was released 11 days ago, which was before this thread was created.
Posted 10 days ago by miles
Version: 24.1.2
Avatar

Hi.

We are developing an application using Docking/MDI and Ribbon.
When we press a button on Ribbon that exists in the main window, we want to specify a floating document as the CommandTarget and execute the command, but in fact the docked document is specified.

We believe that we often encounter this problem when using Docking/MDI. Are there any plans to implement a way to solve this problem with this products?

Comments (3)

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

Hello,

Just for clarification, are you using our older Ribbon product's ribbon control or the newer Bars product's ribbon control?

Routed commands in WPF are all based on the control that has focus.  In WPF when you click on a control in the main Window, in your case a button in the Ribbon, the main Window is activated and core Microsoft WPF logic focuses the last control that was focused in that Window.  That is why you see the button's command get executed on the docked document, which now contains focus, instead of the floating document, which previously contained focus.

This StackOverflow article talks about the exact issue, as it is something that any WPF docking window system would run into.

We don't have a sample yet that illustrates a tested workaround for this, but we should work on adding one.


Actipro Software Support

Posted 10 days ago by miles
Avatar

Thanks for the reply.

We are using ActiproSoftware.Controls.WPF.Ribbon version 24.1.1.

We understood that this is a WPF standard focus specification and is not currently supported.

We hope that samples will be provided in the future, or that functionality will be provided as a product.

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

Hello,

We've done some work the past couple days to update WindowChrome to add a feature where it can prevent clicks on ribbons and toolbars from activating the Window (and moving focus).  We've also updated our Bars Ribbon/StandaloneToolBar and older legacy Ribbon products to support the update in combination with using WPF's HwndSource.DefaultAcquireHwndFocusInMenuMode and Keyboard.DefaultRestoreFocusMode properties.

In addition, we've added a sample in the Docking/MDI area for the next build that shows how to integrate the Bars Ribbon and StandaloneToolBar controls with Docking/MDI so that buttons on the main Window toolbars can work on floating docking windows.

The same concepts could be used on the legacy (non-Bars) Ribbon, but the new WindowChrome.CanMouseActivateOverToolBar property  coming in the next build would need to be set a different way than in the new sample.  The legacy Ribbon requires you to programmatically get the existing WindowChrome instance from ribbon:RibbonWindow in code-behind and then set the property in C# code.  Documentation on this concept is here.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.