Back to Devexpress

TreeList.ShowCustomizationForm Event

windowsforms-devexpress-dot-xtratreelist-dot-treelist-f75f6f47.md

latest5.3 KB
Original Source

TreeList.ShowCustomizationForm Event

Fires immediately after the Customization Form has been displayed.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
[DXCategory("Behavior")]
public event EventHandler ShowCustomizationForm
vb
<DXCategory("Behavior")>
Public Event ShowCustomizationForm As EventHandler

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:

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

HideCustomizationForm

ShowCustomization

HideCustomization()

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace