Skip to content

DevExpress-Examples/winforms-diagram-track-and-restrict-drag-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Diagram Control - Track and Restrict Drag Actions

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 DiagramControl.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.

Files to Review

Documentation

About

Restrict different drag/move actions in the Diagram Control.

Topics

Resources

License

Stars

Watchers

Forks

Languages