Skip to main content

VGridControlBase.ShowEditor() Method

Invokes the focused cell’s editor.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

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

Declaration

public virtual void ShowEditor()

Remarks

The ShowEditor method is automatically called when end-users invoke a cell editor. You can also call this method manually. Note that if you want to activate a particular cell’s editor, you need to focus the cell first. Use the VGridControlBase.FocusedRow and VGridControlBase.FocusedRecord properties for this purpose.

A cell editor cannot be activated if the VGridControlBase.CanShowEditor property returns false (the user cannot edit the focused cell’s value).

For more information, see Showing and Hiding Editors.

Example

The following sample code assumes that a grid control has the row_Price editor row containing information about car prices. The code invokes the Price field editor of the first record when the form is loaded. When the editor is closed (here the code handles the VGridControlBase.HiddenEditor event), the next record is focused and the editor for the Price field is again invoked, etc.

private void Form1_Load(object sender, System.EventArgs e) {
    // some code concerning binding grid to data
    /....
    // invoking editor for the first data cell of the Price row
    vGridControl1.FocusedRecord = 0;
    vGridControl1.FocusedRow = vGridControl1.Rows["row_Price"];
    vGridControl1.ShowEditor();
}

private void vGridControl1_HiddenEditor(object sender, System.EventArgs e) {
    VGridControl vGrid = sender as VGridControl;
    // checking whether the Price row is focused
    if (vGrid.FocusedRow != vGrid.Rows["row_Price"]) return;
    if (vGrid.FocusedRecord == vGrid.RecordCount - 1) 
        vGrid.FocusedRecord = 0;
    else 
        vGrid.FocusedRecord++;
    // invoking editor for the currently focused data cell
    vGrid.ShowEditor();
}
See Also