TreeList.CustomizationForm Property
Gets the object representing the Customization Form.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v24.2.dll
Declaration
Property Value
Type |
---|
DevExpress.XtraTreeList.TreeListCustomizationForm |
Remarks
The Customization Form enables end-users to hide columns and bands and make them visible again. This can be performed by dragging a column/band header to this form and back to the column/band header panel. You can invoke the Customization Form by calling the TreeList.ShowCustomization method. It can also be invoked by end-users. They must right-click the column header panel and choose the Runtime Column Customization item of the context menu.
Note: users can drag a column header to the Customization Form if both the TreeListOptionsColumn.AllowMove and TreeListOptionsColumn.AllowMoveToCustomizationForm options are enabled for the corresponding column.
The CustomizationForm property provides access to the object representing the Customization Form. This object is a descendant of the System.Windows.Forms.Form class and thus can be adjusted as a regular form. For instance, you can change the caption of this form, assign a context menu to it, etc.
Note: the Customization Form is recreated each time it is invoked. Thus, changes can be applied to it only when it is visible and are not saved after it has been closed. You need to handle the TreeList.ShowCustomizationForm event to apply the desired changes each time the form is invoked.
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();
}