示例#1
0
 private void HandleDrag(DragEventArgs e)
 {
     DragLayer.UpdateAdornerPosition(e);
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         e.Effects = DragDropEffects.Link;
     }
     else
     {
         DataSourcesControl.Instance?.HandleDrag(e);
     }
     e.Handled = true;
 }
示例#2
0
        private void PartDataSourcesOnMouseMove(object sender, MouseEventArgs e)
        {
            if (DragLayer.ShouldStartDrag(e))
            {
                IDataSourceViewModel source       = SelectedItem;
                TreeViewItem         treeViewItem = SelectedTreeViewItem;

                if (treeViewItem.IsMouseOver && ((DataSourcesViewModel)DataContext).CanBeDragged(source))
                {
                    DragLayer.DoDragDrop(source, treeViewItem, DragDropEffects.Move);
                }
            }
        }
示例#3
0
        public void HandleDrag(DragEventArgs e)
        {
            DragLayer.UpdateAdornerPosition(e);

            DropInfo dropInfo;

            if (IsValidDrop(e, out dropInfo))
            {
                DragLayer.AdornDropTarget(dropInfo);
                e.Effects = DragDropEffects.Move;
                e.Handled = true;
            }
        }
示例#4
0
 private void OnMouseMove(object sender, MouseEventArgs e)
 {
     if (DragLayer.ShouldStartDrag(e))
     {
         // Get the item under the mouse
         var relativePosition = e.GetPosition(this);
         var element          = InputHitTest(relativePosition) as FrameworkElement;
         var uiElement        = element.FindFirstAncestorWithName("PART_WidgetFactory");
         var factory          = uiElement?.DataContext as WidgetFactoryViewModel;
         if (factory != null)
         {
             DragLayer.DoDragDrop(factory, uiElement, DragDropEffects.Copy);
         }
     }
 }
示例#5
0
        public void PartDataSourcesOnDrop(object sender, DragEventArgs e)
        {
            DropInfo dropInfo;

            if (IsValidDrop(e, out dropInfo))
            {
                var vm = DataContext as DataSourcesViewModel;
                vm?.OnDropped(dropInfo.Source.ViewModel,
                              dropInfo.Target.ViewModel,
                              dropInfo.Type);

                e.Handled = true;
            }
            DragLayer.RemoveArrangeAdorner();
            DragLayer.RemoveDropAdorner();
        }
示例#6
0
 private void OnMouseMove(object sender, MouseEventArgs e)
 {
     DragLayer.OnMouseMove(e);
 }