Skip to main content

How to: Prohibit Dropping to a Group

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.

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;