public static IMouseDataSource DragTarget(this IMouseDataSource src, double opacity = 1) { if (src.Target is not FrameworkElement target) { return(src); } src.BindLocalDragger( LocalDragger.MinimumDrag(new DragUiWindow(target, opacity))); return(src); }
public void MouseDownHandler(IMouseClickReport report) { Message = $"Clicked ({report.AbsoluteLocation()}) / ({report.RelativeLocation()})"; report .ExtractSize(out var size) .DragSource() .BindLocalDragger( LocalDragger.MinimumDrag( LocalDragger.RelativeToSize(size, LocalDragger.Action(p => Message = $"Drag to {p}")))); }
public static IMouseDataSource Drag(this IMouseDataSource mon, Func <IDataObject> dataToDrag, DragDropEffects allowedEffects, Action <DragDropEffects>?onDragDone = null) { mon.BindLocalDragger( LocalDragger.MinimumDrag( LocalDragger.MaxMoves(1, LocalDragger.Action((_, __) => { var ret = new DragHandler(mon).InitiateDrag(dataToDrag(), allowedEffects); onDragDone?.Invoke(ret); })))); return(mon); }