ActiveWindow not Updated whith hosted WinForms-Control in floating window

Docking/MDI for WPF Forum

Posted 9 years ago by Stefan Link
Version: 14.2.0611

When hosting a Windows Forms Control inside a WPF DockSite window, the ActiveWindow (and also LastActiveXXXWindow) is not updated properly for floating windows.


<Window x:Class="WpfApplication7.MainWindow"
        Title="MainWindow" Height="350" Width="525">
                    <docking:DocumentWindow Title="Forms" CanRaft="True">
                            <forms:TextBox />
                    <docking:DocumentWindow Title="WPF" CanRaft="True">
                        <TextBox />

 To reproduce:

  1. Start the application and attach Snoop, to check the actual values for ActiveWindow and LastActiveXXXWindow.
  2. Make the document window "Forms" floating.
  3. Now switch between the document window "WPF" within the main window and the floating window "Forms" and watch the ActiveWindow and LastActiveXXXWindow properties.

-> In both cases the ActiveWindow and LastActiveDocumentWindow is the "WPF"-window.

Is there a way to get those properties (and the associated events) work in this case?


Thanks in advance


Comments (2)

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

Hi Stefan,

Check out the "Docking & MDI / Interoperability / WinForms Compatibility" topic in the documentation that comes with the product.  That describes an attached property on InteropFocusTracking that should always be set on any WindowsFormsHost to improve focus tracking, since WPF doesn't properly track focus changes with WinForms controls.  Please try that and see if it resolves the problem.

Actipro Software Support

Posted 9 years ago by Stefan Link

Thanks for the answer, we tested the property and for "simple" WinForms UIs this property works.

Unfortunately the property doesn't work for the WinForms UIs (from a third party application) we have to host within our application.

But your source code gave us some clue what to do to "fix" the ActiveWindow and LastActiveXXXWindow properties with a little use of reflection.

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.