Example #1
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);
                }
            }
        }
Example #2
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);
         }
     }
 }