ColumnView.ActiveEditor Property

Gets a View's active editor.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[Browsable(false)]
public override BaseEdit ActiveEditor { get; }
<Browsable(False)>
Public Overrides ReadOnly Property ActiveEditor As BaseEdit

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 real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.

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

}
See Also