Skip to content

Commit aed7a02

Browse files
committed
GetFloatingWindowsByZOrder also from mainProcess when no other windowParentHandle is available
1 parent b054943 commit aed7a02

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

source/Components/Xceed.Wpf.AvalonDock/DockingManager.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This program is provided to you under the terms of the Microsoft Public
3030
using System.Windows.Data;
3131
using System.Windows.Threading;
3232
using Xceed.Wpf.AvalonDock.Themes;
33+
using System.Diagnostics;
3334

3435
namespace Xceed.Wpf.AvalonDock
3536
{
@@ -2207,12 +2208,20 @@ internal void StartDraggingFloatingWindowForPane( LayoutAnchorablePane paneModel
22072208

22082209
internal IEnumerable<LayoutFloatingWindowControl> GetFloatingWindowsByZOrder()
22092210
{
2211+
IntPtr windowParentHanlde;
22102212
var parentWindow = Window.GetWindow( this );
2213+
if( parentWindow != null )
2214+
{
2215+
windowParentHanlde = new WindowInteropHelper( parentWindow ).Handle;
2216+
}
2217+
else
2218+
{
2219+
var mainProcess = Process.GetCurrentProcess();
2220+
if( mainProcess == null )
2221+
yield break;
22112222

2212-
if( parentWindow == null )
2213-
yield break;
2214-
2215-
IntPtr windowParentHanlde = new WindowInteropHelper( parentWindow ).Handle;
2223+
windowParentHanlde = mainProcess.MainWindowHandle;
2224+
}
22162225

22172226
IntPtr currentHandle = Win32Helper.GetWindow( windowParentHanlde, ( uint )Win32Helper.GetWindow_Cmd.GW_HWNDFIRST );
22182227
while( currentHandle != IntPtr.Zero )

0 commit comments

Comments
 (0)