ColumnView.ActiveEditor Property
Gets a View’s active editor.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v24.2.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
#Declaration
#Property Value
Type | Description |
---|---|
Base |
The currently active editor. null (Nothing in Visual Basic) if there are no active editors at the time. |
#Remarks
When a user starts to edit a cell value, the grid creates an editor for the cell. When a user has completed the value change, the grid destroys the cell editor. Thus, there can be only one active editor instance at any moment.
Use the ActiveEditor property to return the current active editor. If no cell editor is currently active, the ActiveEditor returns null (Nothing in Visual Basic).
You can use the ActiveEditor property to change editor settings dynamically. This property is also useful if you need to perform specific actions (such as open the editor’s dropdown window, etc.) when users activate particular editors or when they want to perform specific actions. Note that you will need to handle the ColumnView.ShownEditor event to respond to editor activation.
Note: the ActiveEditor property returns a BaseEdit object. This object is the base for all in-place editors in Grid Views. Thus, you may need to typecast to use editor-specific properties.
Note
Detail pattern Views do not contain data and they are never displayed within Xtra
- Grid
Control. - returns the top most View in a grid;Main View - Grid
Control. - returns the focused View;Focused View - Grid
Control. - returns the currently maximized View;Default View - the sender parameter of View specific events;
- Grid
View. - returns a detail clone View for a specific master row.Get Detail View
The code sample below illustrates how to populate an empty editor with the current date.
EmployeesGridView.ShownEditor += EmployeesGridView_ShownEditor;
private void EmployeesGridView_ShownEditor(object sender, EventArgs e)
{
ColumnView view = (ColumnView)sender;
if (view.FocusedColumn.FieldName == "VacationDate" && view.ActiveEditor.EditValue=="")
{
view.ActiveEditor.EditValue = DateTime.Now.ToString("MM/dd/yyyy");
}
}
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ActiveEditor property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.