All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

TreeList.EditFormShowing Event

Fires when the Edit Form is about to be displayed. Allows you to cancel the action.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v20.1.dll

Declaration

[DXCategory("Editor")]
public event EditFormShowingEventHandler EditFormShowing
<DXCategory("Editor")>
Public Event EditFormShowing As EditFormShowingEventHandler

Event Data

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

Property Description
Allow Gets or sets whether it is allowed to show the Edit Form.
Node Gets the node for which the Edit Form is about to be shown.

Examples

The code below shows how to prevent the Edit Form from being shown in a particular case, focus an editor in the Edit Form, subscribe to the editor's events, and get the clicked button when the Edit Form is closed.

using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraTreeList;

// Prevents the Edit Form from being shown depending on the cell data.
private void treeList1_EditFormShowing(object sender, DevExpress.XtraTreeList.EditFormShowingEventArgs e) {
    if (e.Node.GetValue(colCity).Equals("Berlin"))
        e.Allow = false;
}
// Focuses the editor in the Edit Form that corresponds to the column focused in the Tree List.
// Subscribes to an editor's events.
private void treeList1_EditFormPrepared(object sender, DevExpress.XtraTreeList.EditFormPreparedEventArgs e) {
    TreeList treeList = sender as TreeList;
    Control editor = e.BindableControls[treeList.FocusedColumn];
    if (editor != null) {
        editor.Focus();
        ((IContainerControl)e.Panel).ActivateControl(editor);
    }

    TextEdit textEdit = e.BindableControls[colCity] as TextEdit;
    if (textEdit != null)
        textEdit.EditValueChanging += TextEdit_EditValueChanging;
}
private void TextEdit_EditValueChanging(object sender, ChangingEventArgs e) {
    // ...
}
// Unsubscribes from the editor's events.
// Shows a message depending on the clicked button.
private void treeList1_EditFormHidden(object sender, DevExpress.XtraTreeList.EditFormHiddenEventArgs e) {
   TextEdit textEdit = e.BindableControls[colCity] as TextEdit;
    if (textEdit != null)
        textEdit.EditValueChanging -= TextEdit_EditValueChanging;
    if (e.Result == EditFormResult.Update)
        XtraMessageBox.Show("Changes are successfully saved.");

}
See Also