Back to Devexpress

TreeList.CustomizationForm Property

windowsforms-devexpress-dot-xtratreelist-dot-treelist-5119ea5b.md

latest5.9 KB
Original Source

TreeList.CustomizationForm Property

Gets the object representing the Customization Form.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
[Browsable(false)]
public TreeListCustomizationForm CustomizationForm { get; }
vb
<Browsable(False)>
Public ReadOnly Property CustomizationForm As TreeListCustomizationForm

Property Value

TypeDescription
DevExpress.XtraTreeList.TreeListCustomizationForm

The object representing the Customization Form

|

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:

csharp
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();
}
vb
Imports DevExpress.XtraTreeList.Columns;

Private Sub TreeList1_ShowCustomizationForm(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles TreeList1.ShowCustomizationForm
    barManager1.SetPopupContextMenu(treeList1.CustomizationForm, popupMenu1)
End Sub

Private Sub btnDisplayAll_ItemClick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MenuItem1.Click
   Dim Column As TreeListColumn
   TreeList1.BeginUpdate()
   For Each Column In TreeList1.Columns
      If Column.VisibleIndex = -1 And Column.OptionsColumn.ShowInCustomizationForm Then
         Column.VisibleIndex = TreeList1.Columns.Count
      End If
   Next
   TreeList1.EndUpdate()
End Sub

See Also

ShowCustomization

CustomizationFormBounds

ShowCustomizationForm

AllowMoveToCustomizationForm

ShowInCustomizationForm

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace