Skip to content

Commit

Permalink
(GH-2820) fix for: MahApps.Metro's borderlesswindowbehavior does not …
Browse files Browse the repository at this point in the history
…work with stickywindows.

Closes #2820
Closes #2822
  • Loading branch information
punker76 committed Dec 5, 2018
1 parent f0b7af5 commit 6893565
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/MahApps.Metro/Controls/MetroWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,16 +1353,20 @@ internal static void DoWindowTitleThumbMoveOnDragDelta(IMetroThumb thumb, [NotNu
Mouse.Capture(thumb, CaptureMode.Element);
}
};
window.StateChanged -= windowOnStateChanged;
window.StateChanged += windowOnStateChanged;
}

var criticalHandle = window.CriticalHandle;
// DragMove works too
// window.DragMove();
// instead this 2 lines
#pragma warning disable 618
NativeMethods.SendMessage(criticalHandle, WM.SYSCOMMAND, (IntPtr)SC.MOUSEMOVE, IntPtr.Zero);
NativeMethods.SendMessage(criticalHandle, WM.LBUTTONUP, IntPtr.Zero, IntPtr.Zero);
// these lines are from DragMove
// NativeMethods.SendMessage(criticalHandle, WM.SYSCOMMAND, (IntPtr)SC.MOUSEMOVE, IntPtr.Zero);
// NativeMethods.SendMessage(criticalHandle, WM.LBUTTONUP, IntPtr.Zero, IntPtr.Zero);

var wpfPoint = window.PointToScreen(Mouse.GetPosition(window));
var x = (int)wpfPoint.X;
var y = (int)wpfPoint.Y;
NativeMethods.SendMessage(criticalHandle, WM.NCLBUTTONDOWN, (IntPtr)HT.CAPTION, new IntPtr(x | (y << 16)));
#pragma warning restore 618
}

Expand Down

0 comments on commit 6893565

Please sign in to comment.