1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public const int WM_NCLBUTTONDOWN = 0x00A1;
protected override void OnSourceInitialized(EventArgs e) {
base.OnSourceInitialized(e);
HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
source.AddHook(WndProc);
}
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
// Evenement MouseLeftButtonDown
if (msg == WM_NCLBUTTONDOWN) {
// Fermeture de la popup ou tout autre code...
myPopup.IsOpen = false;
}
return IntPtr.Zero;
} |
Partager