예제 #1
0
        private void AssociatedObject_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point position = e.GetPosition(_associatedObject);

            DragManager.InitializeDrag(_associatedObject, position);
            _isMouseDown = true;
        }
예제 #2
0
 private void AssociatedObject_PreviewMouseMove(object sender, MouseEventArgs e)
 {
     if (_isMouseDown)
     {
         Point position = e.GetPosition(_associatedObject);
         DragManager.InitiateDrag(_associatedObject, position);
     }
 }
예제 #3
0
 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);
 }
예제 #4
0
 protected override void OnChanged()
 {
     DragManager.RegisterDragSource(AssociatedObject, OnDragInitialize, OnDropComplete, null, null, null);
 }
예제 #5
0
 private void AssociatedObject_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     _isMouseDown = false;
     DragManager.FinalizeDrag();
 }