Drag and drop tabs in Windows Forms Tabbed Form (SfTabbedForm)
21 Jan 20252 minutes to read
Tabbed Form allows move the tabs from one position to another position by dragging the corresponding tab. This can be done by setting the TabbedFormControl.AllowDraggingTabs property to true.
tabbedFormControl.AllowDraggingTabs = true;tabbedFormControl.AllowDraggingTabs = True
Cancel tab dragging
Dragging a particular tab in TabbedForm can be canceled by handling the TabDragging event by setting e.Cancel to true when e.Action is TabDraggingAction.DragStarting.
this.TabbedFormControl.TabDragging += OnTabDragging;
private void OnTabDragging(object sender, TabDraggingEventArgs e)
{
if (e.From == 1 && e.Action == TabDraggingAction.DragStarting)
e.Cancel = true;
}AddHandler TabbedFormControl.TabDragging, AddressOf OnTabDragging
Private Sub OnTabDragging(ByVal sender As Object, ByVal e As TabDraggingEventArgs)
If e.From = 1 AndAlso e.Action = TabDraggingAction.DragStarting Then
e.Cancel = True
End If
End SubCancel tab reordering
Re-ordering a tab to a particular position can be canceled by handling TabDragging event by setting e.Cancel to true when e.Action is TabDraggingAction.DragDropping.
this.TabbedFormControl.TabDragging += OnTabDragging;
private void OnTabDragging(object sender, TabDraggingEventArgs e)
{
if (e.To == 1 && e.Action == TabDraggingAction.DragDropping)
e.Cancel = true;
}AddHandler TabbedFormControl.TabDragging, AddressOf OnTabDragging
Private Sub OnTabDragging(ByVal sender As Object, ByVal e As TabDraggingEventArgs)
If e.To = 1 AndAlso e.Action = TabDraggingAction.DragDropping Then
e.Cancel = True
End If
End Sub