|
8 | 8 | using System.ComponentModel; |
9 | 9 | using System.Diagnostics.CodeAnalysis; |
10 | 10 | using System.Linq; |
11 | | -using System.Reflection; |
12 | 11 | using System.Windows; |
13 | 12 | using System.Windows.Automation; |
14 | 13 | using System.Windows.Automation.Peers; |
|
18 | 17 | using System.Windows.Media.Animation; |
19 | 18 | using System.Windows.Shapes; |
20 | 19 | using System.Windows.Controls.Primitives; |
| 20 | +using System.Windows.Interop; |
21 | 21 | using Windows.Win32; |
22 | 22 | using Windows.Win32.Foundation; |
23 | 23 | using ControlzEx; |
@@ -220,7 +220,7 @@ public static readonly DependencyProperty ShowFlyoutsOverDialogsProperty |
220 | 220 | if (d is MetroWindow window && window.Flyouts != null) |
221 | 221 | { |
222 | 222 | // It's not allowed to change this if any Flyout is open |
223 | | - // TODO Find a way to reset the zIndex of any open Flyout if <see cref="ShowFlyoutsOverDialogs"/> is changed by the user |
| 223 | + // TODO Find a way to reset the zIndex of any open Flyout if <see cref="ShowFlyoutsOverDialogs"/> is changed by the user |
224 | 224 | var anyFlyoutOpen = window.Flyouts.GetFlyouts().Any(f => f.IsOpen); |
225 | 225 | if (anyFlyoutOpen) |
226 | 226 | { |
@@ -1457,16 +1457,6 @@ protected override AutomationPeer OnCreateAutomationPeer() |
1457 | 1457 | return new MetroWindowAutomationPeer(this); |
1458 | 1458 | } |
1459 | 1459 |
|
1460 | | - protected internal IntPtr CriticalHandle |
1461 | | - { |
1462 | | - get |
1463 | | - { |
1464 | | - this.VerifyAccess(); |
1465 | | - var value = typeof(Window).GetProperty("CriticalHandle", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(this, new object[0]) ?? IntPtr.Zero; |
1466 | | - return (IntPtr)value; |
1467 | | - } |
1468 | | - } |
1469 | | - |
1470 | 1460 | private void ClearWindowEvents() |
1471 | 1461 | { |
1472 | 1462 | if (this.windowTitleThumb != null) |
@@ -1642,7 +1632,8 @@ internal static void DoWindowTitleThumbMoveOnDragDelta(IMetroThumb? thumb, Metro |
1642 | 1632 | var wpfPoint = window.PointToScreen(Mouse.GetPosition(window)); |
1643 | 1633 | var x = (int)wpfPoint.X; |
1644 | 1634 | var y = (int)wpfPoint.Y; |
1645 | | - PInvoke.SendMessage(new HWND(window.CriticalHandle), PInvoke.WM_NCLBUTTONDOWN, new WPARAM((nuint)HT.CAPTION), new IntPtr(x | (y << 16))); |
| 1635 | + var windowHandle = new WindowInteropHelper(window).EnsureHandle(); |
| 1636 | + PInvoke.SendMessage(new HWND(windowHandle), PInvoke.WM_NCLBUTTONDOWN, new WPARAM((nuint)HT.CAPTION), new IntPtr(x | (y << 16))); |
1646 | 1637 | } |
1647 | 1638 |
|
1648 | 1639 | internal static void DoWindowTitleThumbChangeWindowStateOnMouseDoubleClick(MetroWindow window, MouseButtonEventArgs mouseButtonEventArgs) |
|
0 commit comments