Skip to main content
All docs
V25.1
  • EditFormUserControl Class

    Represents a custom Edit Form in the Tree List.

    Namespace: DevExpress.XtraTreeList

    Assembly: DevExpress.XtraTreeList.v25.1.dll

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

    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.

    Follow the steps below to display a custom user control instead of the default Edit Form:

    • use the EditFormUserControl class as a base class for a custom Edit Form;
    • place editors onto the created Edit Form;
    • bind editors to data fields (see below);
    • assign the created Edit Form to the CustomEditFormLayout property.

    The EditFormUserControl is an IExtenderProvider. To bind editors to data fields, use the following extender properties allocated to editors by the EditFormUserControl:

    Example

    The code below creates a custom Edit Form.

    image

    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 following demo for the complete example: Edit nodes with a custom Edit Form.

    See Also