TreeList.ShowCustomizationForm Event
Fires immediately after the Customization Form has been displayed.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v24.2.dll
Declaration
Event Data
The ShowCustomizationForm event's data class is EventArgs.
Remarks
Users can invoke the Customization Form via the Runtime Column Customization item of the column headers context menu. Note that this menu is only available when the TreeListOptionsMenu.EnableColumnMenu option is enabled.
You can invoke the Customization Form in code by calling the TreeList.ShowCustomization method.
The ShowCustomizationForm event enables you to perform specific actions each time the Customization Form is invoked either by an end-user or in code. This can be used in the following two cases:
- You need to update other controls when the Customization Form appears. For instance, you may want to output instructions on how to use this form.
- You need to change the look and feel of the Customization Form or adjust it in some other manner. In this case, the ShowCustomizationForm event must be handled since the form is recreated each time it is displayed. Thus, settings applied to it are not saved when closing the form and invoking it again. Note, that you must use the TreeList.CustomizationForm property to access the form settings.
Use the TreeList.HideCustomizationForm event to respond to the closing of the Customization Form.
Example
The following sample code assigns a PopupMenu to the Tree List control’s Customization Form. The menu contains a single item that makes all hidden columns visible.
This example provides handlers for two events:
- The
TreeList.ShowCustomizationForm
event handler. It is used to assign an existing PopupMenu to the form. - The handler of the menu item click event. This handler makes all hidden columns visible using the TreeListColumn.Visible property. Columns whose TreeListOptionsColumn.ShowInCustomizationForm option is disabled are not affected.
using DevExpress.XtraTreeList.Columns;
private void treeList1_ShowCustomizationForm(object sender, System.EventArgs e) {
barManager1.SetPopupContextMenu(treeList1.CustomizationForm, popupMenu1);
}
private void btnDisplayAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
treeList1.BeginUpdate();
foreach (TreeListColumn column in treeList1.Columns) {
if (column.VisibleIndex == -1 && column.OptionsColumn.ShowInCustomizationForm)
column.VisibleIndex = treeList1.Columns.Count;
}
treeList1.EndUpdate();
}