Skip to main content

ColumnView.ActiveEditor Property

Gets a View’s active editor.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v23.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[Browsable(false)]
public override BaseEdit ActiveEditor { get; }

Property Value

Type Description
BaseEdit

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 XtraGrid. So, the ActiveEditor member must not be invoked for these Views. The ActiveEditor member can only be used with Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.

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");
    }

}

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.

See Also