EditFormUserControl Class
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v19.2.dll
Declaration
public class EditFormUserControl :
XtraUserControl,
IExtenderProvider,
IEditorFormTagProvider
Remarks
You can allow users to edit cell values in the Edit Form instead of In-place Editors. The Tree List automatically creates a default Edit Form based on data fields. You can also use a custom user control instead of the default Edit Form.
The EditFormUserControl
class serves as a base class for a custom Edit Form. Use the SetBoundFieldName method to bind an editor on the Edit Form to a data source field. Use the SetBoundPropertyName method to specify the editor property that is bound to the data source field. If the property name is not specified, the data source field is bound to the Control.Text or BaseEdit.EditValue property depending on the editor type.
The following code shows how to create the Edit Form shown in the figure above.
using DevExpress.XtraEditors;
using DevExpress.XtraTreeList;
treeList.OptionsBehavior.EditingMode = TreeListEditingMode.EditForm;
// Create a custom EditForm
var control = new EditFormUserControl();
control.Height = treeList.Height / 2;
// Add editors
MemoEdit memoEditNotes = new MemoEdit();
memoEditNotes.Dock = DockStyle.Fill;
TextEdit textEditName = new TextEdit();
textEditName.Dock = DockStyle.Top;
TextEdit textEditType = new TextEdit();
textEditType.Dock = DockStyle.Top;
DateEdit dateEditDate = new DateEdit();
dateEditDate.Dock = DockStyle.Bottom;
control.Controls.Add(memoEditNotes);
control.Controls.Add(dateEditDate);
control.Controls.Add(textEditType);
control.Controls.Add(textEditName);
// Bind the editors to data source fields
control.SetBoundFieldName(memoEditNotes, "Notes");
control.SetBoundFieldName(textEditName, "Name");
control.SetBoundFieldName(textEditType, "TypeOfObject");
control.SetBoundFieldName(dateEditDate, "RecordDate");
// Assign the Edit Form to the Tree List
treeList.OptionsEditForm.CustomEditFormLayout = control;
Note
Run the XtraTreeList demo for the complete example.