Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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;
   }
}