This example restricts different drag actions within the DevExpress WPF Diagram Control.
The DiagramControl
allows you to use multiple events (raised at different moments in time) to customize/prohibit drag operations:
- The AddingNewItem event is raised when a user drags a new item to the canvas.
- The BeforeItemsMoving event is raised when a user initiates an item drag/move action. This event allows you to customize dragged items.
- The ItemsMoving event is raised during item drag/move operations. This event allows you to restrict this action based on stage, item position, and item parent.
By handling these events, you can introduce the following restrictions:
- You cannot drop "Rectangle" and "Ellipse" shapes to the canvas.
- You cannot move the "Triangle" shape once you drop it onto the canvas.
- You cannot move the "RightTriangle" shape to a container if it contains at least one "RightTriangle" shape.
- You cannot drop the "Pentagon" shape near other shapes.
(you will be redirected to DevExpress.com to submit your response)