protected override void DragStart(object sender, MouseEventArgs e) { var source = (DependencyObject)e.OriginalSource; var sourceTypes = dragDropPairs?.Select(s => s.SourceType).ToList(); if (Utils.FindParentOfTypes(source, sourceTypes) is FrameworkElement sourceParent) { var args = new UiDragDropArgs { SourceElement = sourceParent, Source = sourceParent.DataContext }; CallOnDragChain(args); DragDrop.DoDragDrop(source, new DataObject(Key, args), DragDropEffects.Link); startPosition = null; } }
private void CallOnDropChain(UiDragDropArgs args) { args.Handled = false; OnDrop?.Invoke(args); if (args.Handled) { return; } if (args.Target is IDragDropAware targetAware) { targetAware.OnDrop(args); if (args.Handled) { return; } } if (args.TargetElement != containerElement && containerElement.DataContext is IDragDropAware elementAware) { elementAware.OnDrop(args); } }
private void CallOnDragChain(UiDragDropArgs args) { args.Handled = false; OnDrag?.Invoke(args); if (args.Handled) { return; } if (args.Source is IDragDropAware sourceAware) { sourceAware.OnDrag(args); if (args.Handled) { return; } } if (args.SourceElement != containerElement && containerElement.DataContext is IDragDropAware elementAware) { elementAware.OnDrag(args); } }