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; }
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); } } }
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; } }
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); } } }
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(); }
private void OnMouseMove(object sender, MouseEventArgs e) { DragLayer.OnMouseMove(e); }