private void AssociatedObject_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Point position = e.GetPosition(_associatedObject); DragManager.InitializeDrag(_associatedObject, position); _isMouseDown = true; }
private void AssociatedObject_PreviewMouseMove(object sender, MouseEventArgs e) { if (_isMouseDown) { Point position = e.GetPosition(_associatedObject); DragManager.InitiateDrag(_associatedObject, position); } }
private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) { if (!(sender is Panel panel)) { return; } if (panel.Background == null) { panel.Background = Brushes.Transparent; } panel.AllowDrop = true; panel.DragEnter += new DragEventHandler(AssociateObject_DragEnter); panel.DragOver += new DragEventHandler(AssociatedObject_DragOver); DragManager.RegisterDragContext(panel, AssociatedObject_DropCompleted); }
protected override void OnChanged() { DragManager.RegisterDragSource(AssociatedObject, OnDragInitialize, OnDropComplete, null, null, null); }
private void AssociatedObject_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { _isMouseDown = false; DragManager.FinalizeDrag(); }