windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-57c905eb.md
A custom edit form for the Data Grid control.
Namespace : DevExpress.XtraGrid.Views.Grid
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[DXLicenseWinForms]
public class EditFormUserControl :
XtraUserControl,
IExtenderProvider,
IEditorFormTagProvider
<DXLicenseWinForms>
Public Class EditFormUserControl
Inherits XtraUserControl
Implements IExtenderProvider,
IEditorFormTagProvider
The EditFormUserControl binds its editors to data fields in the grid. For this purpose, the EditFormUserControl provides the following extender properties for the contained editors:
If an editor is contained on a EditFormUserControl descendant, you can specify the extender properties in Designer using the Properties window as shown below.
In code, you can get and set the extender properties using the following methods:
The code snippet below shows a sample Edit Form.
using DevExpress.XtraGrid.Views.Grid;
class MyEditForm : EditFormUserControl {
private DevExpress.XtraEditors.TextEdit textEdit1;
public MyEditForm() {
this.textEdit1 = new DevExpress.XtraEditors.TextEdit();
this.textEdit1.Location = new System.Drawing.Point(0, 0);
this.textEdit1.Size = new System.Drawing.Size(100, 22);
this.SetBoundFieldName(this.textEdit1, "Price");
this.SetBoundPropertyName(this.textEdit1, "EditValue");
this.Controls.Add(this.textEdit1);
this.Size = new System.Drawing.Size(400, 200);
}
}
//...
gridView1.OptionsBehavior.EditingMode = GridEditingMode.EditForm;
gridView1.OptionsEditForm.CustomEditFormLayout = new MyEditForm();
Public Class MyEditForm
Inherits DevExpress.XtraGrid.Views.Grid.EditFormUserControl
Friend WithEvents TextEdit1 As DevExpress.XtraEditors.TextEdit
Public Sub New()
Me.TextEdit1 = New DevExpress.XtraEditors.TextEdit()
Me.TextEdit1.Location = New System.Drawing.Point(0, 0)
Me.TextEdit1.Size = New System.Drawing.Size(100, 22)
Me.TextEdit1.TabIndex = 0
Me.SetBoundFieldName(Me.TextEdit1, "City")
Me.SetBoundPropertyName(Me.TextEdit1, "EditValue")
Me.Controls.Add(Me.TextEdit1)
Me.Size = New Size(400, 200)
End Sub
End Class
' ...
Me.GridView1.OptionsBehavior.EditingMode = DevExpress.XtraGrid.Views.Grid.GridEditingMode.EditForm
Me.GridView1.OptionsEditForm.CustomEditFormLayout = New MyEditForm()
The created custom Edit Form should be assigned to the GridOptionsEditForm.CustomEditFormLayout property.
See the Modify and Validate Cell Values topic to learn more about how to edit and validate data in the grid.
Object MarshalByRefObject Component Control ScrollableControl ContainerControl UserControl XtraUserControl EditFormUserControl
See Also