protected override void PlatformCapture(IInputElement element) { var hwnd = ((element?.GetVisualRoot() as TopLevel)?.PlatformImpl as WindowImpl) ?.Handle.Handle; if (hwnd.HasValue && hwnd != IntPtr.Zero) { UnmanagedMethods.SetCapture(hwnd.Value); } else { UnmanagedMethods.ReleaseCapture(); } }
protected override void PlatformCapture(IInputElement control) { if (control == null) { System.Windows.Input.Mouse.Capture(null); } else if ((control.GetVisualRoot() as EmbeddableControlRoot)?.PlatformImpl != _impl) { throw new ArgumentException("Visual belongs to unknown toplevel"); } else { System.Windows.Input.Mouse.Capture(_impl); } }