Dear Actipro team,
we have discovered another focus issue when using some hosted WinForms user controls as the DocumentWindow's content.
The issue can be reproduced with a simple setup:
<docking:DockSite UseHostedPopups="False" IsLiveSplittingEnabled="False">
<docking:Workspace>
<docking:TabbedMdiHost>
<docking:DocumentWindow Title="Interop WinForms+WPF">
<WindowsFormsHost docking:InteropFocusTracking.IsEnabled="True">
<local:NestedUserControl/>
</WindowsFormsHost>
</docking:DocumentWindow>
</docking:TabbedMdiContainer>
</docking:TabbedMdiHost>
</docking:Workspace>
</docking:DockSite>
Note that we're using the InteropFocusTracking.IsEnabled attached property as suggested in the documentation.
The NestedUserControl is a simple WinForms user control:
public partial class NestedUserControl : UserControl
{
public NestedUserControl()
{
InitializeComponent();
elementHost1.Child = new WpfUserControl();
}
}
It contains some native WinForms controls and an ElementHost that holds a WPF user control:
<UserControl x:Class="ActiproInterop.WpfUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Orientation="Vertical">
<TextBox Margin="16" Text="Hosted WPF Control"/>
</StackPanel>
</UserControl>
So we have a nested setup in this case: DocumentWindow (WPF) -> UserControl (WinForms) - > UserControl (WPF).
This setup works well (despite of two levels nesting), but we have a problem that the DocumentWindow's title bar (tab header) becomes inactive (selected but not focused) on mouse clicks inside the nested WPF user control. Sometimes it gets active back, but then resets to inactive again. Just some clicks on the WinForms and nested WPF controls - you'll see that.
Could you please check whether it's possible to improve the InteropFocusTracking in that way so it works for a nested setup that we have?