Drag and drop WPF between containers

I have a container, say Grid. It has two containers, for example StackPanels.

There are several rectangles in StackPanel # 1. What is the best way to let the user drag the rectangle and drop it into StackPanel # 2 (and that rectangle will be a child of StackPanel # 2).

I have a draggable bit - the only thing that is unclear is to use containers or just handle all the rectangles manually in a direct canvas.

+5
source share
1 answer

As for the logic of moving around points, but StackPanelas a container is just fine. If you want to view an element while it is being dragged, you can implement Adornerthat displays Visualwhile it is being dragged.

+2
source

All Articles