Skip to main content

DiagramControl.QueryItemSnapping Event

Fires repeatedly as the end-user triggers snapping while dragging or resizing a diagram shape.

Namespace: DevExpress.Xpf.Diagram

Assembly: DevExpress.Xpf.Diagram.v22.1.dll

NuGet Package: DevExpress.Wpf.Diagram


public event EventHandler<DiagramQueryItemSnappingEventArgs> QueryItemSnapping

Event Data

The QueryItemSnapping event's data class is DiagramQueryItemSnappingEventArgs. The following properties provide information specific to this event:

Property Description
Allow Specifies whether to allow snapping of diagram items.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
Item Returns the item that is being dragged by the end-user.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
SnapTo Returns the diagram item to which the item being dragged by the end-user can be snapped.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.


The SnapTo event’s parameter returns the item suitable for snapping (nearest in height/width when the end-user resizes an item or one lying on the same line when the end-user drags an item). The item that is being moved or resized is returned by the Item parameter. The Allow parameter specifies whether to enable snapping to the suitable item.

See Also