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

SpreadsheetControl.Selection Property

Gets or sets a cell range selected in the active worksheet. This is a dependency property.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v24.2.dll

NuGet Package: DevExpress.Wpf.Spreadsheet

#Declaration

[Browsable(false)]
public CellRange Selection { get; set; }

#Property Value

Type Description
CellRange

A CellRange object specifying the range of cells selected in a worksheet that is currently active. If you assign a cell range located in a worksheet that is not active, the selected range will be specified in the active worksheet.

#Remarks

The SpreadsheetControl.ActiveCell property enables you to obtain an active cell, i.e., the cell that is in focus. It is the cell with which the user interacts.

The SpreadsheetControl.SelectedCell property returns the CellRange object that is the active cell of the current worksheet. However, unlike the SpreadsheetControl.ActiveCell property, it enables you to set the active cell by specifying the CellRange. The top left cell of the specified range becomes the selected cell.

The Selection property provides access to a cell range selected in the active worksheet. If there is more than one selected range in the worksheet, this property returns a complex (union) range that includes all the selected areas. You can access an individual range in the selection by its index in the CellRange.Areas collection.

See Also