private void OnDragClickDown(object sender, MouseButtonEventArgs e) { _dragStartPoint = new List <Tuple <Window, Point> >(); var mainWindow = (Window)WpfElementsHelper.GetTopParent(AssociatedObject, typeof(Window)); _isUserDragWindow = true; _dragStartPoint.Add(new Tuple <Window, Point>(mainWindow, e.GetPosition(mainWindow))); foreach (Window ownedWindow in mainWindow.OwnedWindows) { _dragStartPoint.Add(new Tuple <Window, Point>(ownedWindow, e.GetPosition(ownedWindow))); } var element = sender as FrameworkElement; if (element != null) { element.CaptureMouse(); } }
protected override void OnAttached() { base.OnAttached(); AssociatedObject.Click += (sender, args) => MinimizeWindow(); _parentWindow = (Window)WpfElementsHelper.GetTopParent(AssociatedObject, typeof(Window)); }