diff --git a/source/Components/AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs b/source/Components/AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs index b9d6e0a4..8ff5c3f5 100644 --- a/source/Components/AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs +++ b/source/Components/AvalonDock/Controls/LayoutAnchorableFloatingWindowControl.cs @@ -248,14 +248,17 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int switch (msg) { case Win32Helper.WM_ACTIVATE: - var isInactive = ((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE; - if (_model.IsSinglePane) - { - LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this, !isInactive); - } - else - { - LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this, !isInactive); + var isActive = ((int)wParam & 0xFFFF) != Win32Helper.WA_INACTIVE; + if (isActive) + { + if (_model.IsSinglePane) + { + LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this); + } + else + { + LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this); + } } handled = true; diff --git a/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs b/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs index e75d1aa6..db43496c 100644 --- a/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs +++ b/source/Components/AvalonDock/Controls/LayoutDocumentFloatingWindowControl.cs @@ -121,14 +121,17 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int switch (msg) { case Win32Helper.WM_ACTIVATE: - var isInactive = ((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE; - if (_model.IsSinglePane) + var isActive = ((int)wParam & 0xFFFF) != Win32Helper.WA_INACTIVE; + if (isActive) { - LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this, !isInactive); - } - else - { - LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this, !isInactive); + if (_model.IsSinglePane) + { + LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this); + } + else + { + LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this); + } } handled = true; diff --git a/source/Components/AvalonDock/Controls/LayoutFloatingWindowControlHelper.cs b/source/Components/AvalonDock/Controls/LayoutFloatingWindowControlHelper.cs index ca2a0c0c..07ef0f5e 100644 --- a/source/Components/AvalonDock/Controls/LayoutFloatingWindowControlHelper.cs +++ b/source/Components/AvalonDock/Controls/LayoutFloatingWindowControlHelper.cs @@ -13,7 +13,7 @@ internal static class LayoutFloatingWindowControlHelper { private const string Excp_NotSupportedFloatingWindowType = "Not Supported Floating Window Type: {0}"; - public static void ActiveTheContentOfSinglePane(T fwc, bool isActive) where T : LayoutFloatingWindowControl + public static void ActiveTheContentOfSinglePane(T fwc, bool isActive = true) where T : LayoutFloatingWindowControl { ILayoutContentSelector selector = null; if (fwc is LayoutAnchorableFloatingWindowControl) @@ -52,7 +52,7 @@ public static void ActiveTheContentOfSinglePane(T fwc, bool isActive) where T } } - public static void ActiveTheContentOfMultiPane(T fwc, bool isActive) where T : LayoutFloatingWindowControl + public static void ActiveTheContentOfMultiPane(T fwc, bool isActive = true) where T : LayoutFloatingWindowControl { if (isActive) { diff --git a/source/TestApp/MainWindow.xaml b/source/TestApp/MainWindow.xaml index 81e1ee09..fbdf7c9c 100644 --- a/source/TestApp/MainWindow.xaml +++ b/source/TestApp/MainWindow.xaml @@ -115,6 +115,13 @@ Foreground="White" Text="{Binding TestTimer, Mode=OneWay, StringFormat='Document 2 Attached to Timer ->\{0\}'}" /> + +