Back to Devexpress

NavBarControl.NavDragOver Event

windowsforms-devexpress-dot-xtranavbar-dot-navbarcontrol-4b48bfa7.md

latest5.5 KB
Original Source

NavBarControl.NavDragOver Event

Fires repeatedly when a link is being dragged and is allowed to be dropped.

Namespace : DevExpress.XtraNavBar

Assembly : DevExpress.XtraNavBar.v25.2.dll

NuGet Package : DevExpress.Win

Declaration

csharp
public event NavBarDragDropEventHandler NavDragOver
vb
Public Event NavDragOver As NavBarDragDropEventHandler

Event Data

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

PropertyDescription
AllowedEffectGets which drag-and-drop operations are allowed by the originator (or source) of the drag event. Inherited from DragEventArgs.
DataGets the IDataObject that contains the data associated with this event. Inherited from DragEventArgs.
EffectGets or sets the target drop effect in a drag-and-drop operation. Inherited from DragEventArgs.
GroupGets a group into which a dragged item is about to be or has been dropped.
InsertPositionGets the position within the group to which the link is about to be or has been dropped.
KeyStateGets the current state of the SHIFT, CTRL, and ALT keys, as well as the state of the mouse buttons. Inherited from DragEventArgs.
XGets the x-coordinate of the mouse pointer, in screen coordinates. Inherited from DragEventArgs.
YGets the y-coordinate of the mouse pointer, in screen coordinates. Inherited from DragEventArgs.

Remarks

The NavBarControl allows end-users to perform link drag and drop operations. Write a NavDragOver event handler to perform repeated actions when a link is being dragged and it is allowed to be dropped.

Use the NavBarControl.DragDropFlags and NavBarGroup.DragDropFlags properties to control the component’s behavior in relation to link drag and drop operations.

Example

The sample code below represents a NavBarControl.NavDragOver event handler. The event handler prohibits dropping to all but the last item in the group. The target group is identified via the NavBarDragDropEventArgs.Group property of the event’s parameter. The dropping position is obtained via the NavBarDragDropEventArgs.InsertPosition property.

csharp
using DevExpress.XtraNavBar;
using DevExpress.XtraNavBar.ViewInfo;

private void navBarControl1_NavDragOver(object sender, NavBarDragDropEventArgs e) {
   NavBarGroup targetGroup = e.Group;
   if (e.InsertPosition != targetGroup.VisibleItemLinks.Count) {
      e.Effect = DragDropEffects.None;
   }
}
vb
Imports DevExpress.XtraNavBar
Imports DevExpress.XtraNavBar.ViewInfo

Private Sub NavBarControl1_NavDragOver(ByVal sender As Object, _
  ByVal e As NavBarDragDropEventArgs) Handles NavBarControl1.NavDragOver
   Dim TargetGroup As NavBarGroup = e.Group
   If e.InsertPosition <> TargetGroup.VisibleItemLinks.Count Then
      e.Effect = DragDropEffects.None
   End If
End Sub

See Also

NavDragDrop

NavBarControl.DragDropFlags

NavBarGroup.DragDropFlags

NavBarControl Class

NavBarControl Members

DevExpress.XtraNavBar Namespace