windowsforms-405624-common-features-behaviors-multi-cell-edit-behavior.md
Use a MultiCellEditBehavior object to allow a user to edit multiple selected cells simultaneously.
Activate the control’s OptionsSelection.MultiSelect property.
Drop the BehaviorManager component onto the form.
Select Edit Behaviors in the BehaviorManager’s smart tag menu and add a Multi Cell Edit Behavior in the Behavior Editor.
The following code snippet activates multi-cell editing in a GridView:
using DevExpress.XtraEditors;
public class Form1 : XtraForm {
BehaviorManager bm;
public Form1() {
InitializeComponent();
// Activate multi-cell selection
gridView1.OptionsSelection.MultiSelect = true;
// Attach a Multi Cell Edit Behavior
bm = new BehaviorManager(this.components);
bm.Attach<MultiCellEditBehavior>(gridView1);
}
}
Imports DevExpress.XtraEditors
Public Class Form1
Inherits XtraForm
Private bm As BehaviorManager
Public Sub New()
InitializeComponent()
' Activate multi-cell selection
gridView1.OptionsSelection.MultiSelect = True
' Attach a Multi Cell Edit Behavior
bm = New BehaviorManager(Me.components)
bm.Attach(Of MultiCellEditBehavior)(gridView1)
End Sub
End Class
OptionsSelection.MultiSelectMode is set to RowSelect, new values are only applied to the focused column.