GridView.EditFormPrepared Event

Allows you to customize the Edit Form that is about to be displayed.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[DXCategory("Editor")]
public event EditFormPreparedEventHandler EditFormPrepared
<DXCategory("Editor")>
Public Event EditFormPrepared As EditFormPreparedEventHandler

Event Data

The EditFormPrepared event's data class is EditFormPreparedEventArgs. The following properties provide information specific to this event:

Property Description
BindableControls Provides access to the collection of controls used to edit the processed data record. Controls are indexed by field names or grid columns. Inherited from EditFormEventArgsBase.
Panel Gets the container that arranges editors and buttons on the Edit Form. Inherited from EditFormEventArgsBase.
RowHandle Gets the handle that identifies the grid row for which the Edit From is displayed/hidden. Inherited from EditFormEventArgsBase.

Remarks

Before the EditFormPrepared event, the GridView.EditFormShowing event fires, allowing you to cancel the action.

Examples

When the Edit Form is displayed, focus moves to the first editor within the Edit Form. The following example shows how to handle the GridView.EditFormPrepared event to set focus to an editor corresponding to the focused GridColumn.

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        gridView1.EditFormPrepared += gridView1_EditFormPrepared;
    }

    private void gridView1_EditFormPrepared(object sender, DevExpress.XtraGrid.Views.Grid.EditFormPreparedEventArgs e) {
        GridView view = sender as GridView;
        if (e.BindableControls[view.FocusedColumn] != null)
            e.FocusField(view.FocusedColumn);
    }
}
See Also