TreeList.EditFormHidden Event
Fires after the Edit Form is closed.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v19.2.dll
Declaration
Event Data
The EditFormHidden event's data class is EditFormHiddenEventArgs. 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 tree list nodes. |
Node | Gets the node for which the Edit From is closed. |
Panel | Gets the Edit Form’s root panel. |
Result | Gets the clicked button. |
Example
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