This project is read-only.

CanvasDragEventProcessor allow you to drag multiple items from an canvas to different position, by chaning Top and Left property, an adorner with the selected items in lower opacity is shown when dragging.

How to use?

CanvasDragEventProcessor works on canvas only, the Canvas.Left/Top attached property of subItems should be bound to DataContext.Left/Top property.

e.g. MainWindow in DiagramingDemo

You have to enable the processor by using the following code:
    <bc:CanvasDragEventProcessor />
    <bc:MultiSelectEventProcessor EnableMultiSelect="True" 
                                UnselectAllCommand="{Binding Commands.UnselectAllCommand}" />
    <bc:CanvasResizeEventProcessor />

MultiSelect in this case is done by HitTest, if you want better performance you may create a canvas that support IChildInfo interface.


Your container view model (Canvas.DataContext) should implement ISupportDrag or ISupportDragHelper, thus can return selected items.

Your item view model should implement IPositionAware, IDraggable and ISelectable interface.

CanvasDragEventProcessor only update your IPositionAware.Left/Top when drag is completed.

Please see source.

Last edited Oct 17, 2014 at 5:16 PM by lycj, version 9


No comments yet.