BaseView.BeginSelection() Method

Prevents selection updates until the BaseView.EndSelection or the BaseView.CancelSelection method is called.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

public virtual void BeginSelection()
Public Overridable Sub BeginSelection

Remarks

The BeginSelection method, paired with the BaseView.EndSelection/BaseView.CancelSelection method, allows you to improve the grid performance when successively selecting a batch of rows/cells in code. See the Multiple Row and Cell Selection topic, to learn about the methods to select and unselect rows and cells.

If not using the BeginSelection method, the View is updated and the ColumnView.SelectionChanged event fires after every single selection modification. The BeginSelection method, when called prior to changing the selection in code, suspends selection updates until the BaseView.EndSelection or BaseView.CancelSelection method is called.

The EndSelection and CancelSelection methods enable future selection updates, but unlike CancelSelection, the EndSelection method forces an immediate visual update and fires the ColumnView.SelectionChanged event.

NOTE

Each call of the BeginSelection method must correspond to a call of the BaseView.EndSelection or the BaseView.CancelSelection method. To ensure that BaseView.EndSelection or BaseView.CancelSelection is always called even if an exception occurs, use the try...finally statement.

Refer to the Multiple Row and Cell Selection document for more information on row selection. The Batch Modifications Overview topic provides more details on batch modifications.

See Also