Exemplo n.º 1
0
        private void AssociatedObject_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point position = e.GetPosition(_associatedObject);

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