wpf-devexpress-dot-xpf-dot-spreadsheet-dot-spreadsheetcontrol-49b8cc08.md
Gets an active cell in the active worksheet.
Namespace : DevExpress.Xpf.Spreadsheet
Assembly : DevExpress.Xpf.Spreadsheet.v25.2.dll
NuGet Package : DevExpress.Wpf.Spreadsheet
[Browsable(false)]
public Cell ActiveCell { get; }
<Browsable(False)>
Public ReadOnly Property ActiveCell As Cell
| Type | Description |
|---|---|
| Cell |
A Cell object.
|
The SpreadsheetControl.Selection property specifies the selected cell range in the active worksheet (for instance, B3:F9 in the image below). The SpreadsheetControl.SelectedCell property specifies an active cell where data is inserted when a user types (E7 in the image below). Use the SpreadsheetControl.ActiveCell property to obtain this cell. Selection can be a cell or cell range, while SelectedCell is always a single cell within the current selection.
The following code specifies the cell selection and an active cell as shown in the image above.
using DevExpress.Spreadsheet;
// ...
IWorkbook workbook = spreadsheetControl1.Document;
Worksheet activeSheet = workbook.Worksheets.ActiveWorksheet;
// Specify the selected range in the active worksheet.
spreadsheetControl1.Selection = activeSheet.Range["B3:F9"];
// Specify an active cell in the active worksheet.
spreadsheetControl1.SelectedCell = activeSheet.Cells["E7"];
Imports DevExpress.Spreadsheet
' ...
Dim workbook As IWorkbook = spreadsheetControl1.Document
Dim activeSheet As Worksheet = workbook.Worksheets.ActiveWorksheet
' Specify the selected range in the active worksheet.
spreadsheetControl1.Selection = activeSheet.Range("B3:F9")
' Specify an active cell in the active worksheet.
spreadsheetControl1.SelectedCell = activeSheet.Cells("E7")
Note
You can also use the Worksheet.Selection and Worksheet.SelectedCell properties to specify the selected range and active cell in a worksheet.
See Also