Standard Context Menus
- 3 minutes to read
The Tree List control displays default context menus for column headers, nodes, group summary footers, and the total summary footer.
Node Menu
If the TreeList.OptionsMenu.EnableNodeMenu option is enabled, the tree list shows a context menu when a user right-clicks a node.
The context menu contains the following predefined commands:
- Collapse (Expand) – collapses (expands) the clicked node. This command is only shown when the node has children.
- Full Collapse – collapses all nodes.
- Full Expand – expands all nodes.
Use the TreeList.OptionsMenu.ShowExpandCollapseItems property to hide these commands.
If the control displays the New Item Row, the context menu also contains the following commands:
- Add Node – creates a new node at the same level as the clicked node.
- Add Child Node – creates a new child node for the clicked node.
Use the TreeList.OptionsMenu.ShowAddNodeItems property to hide/show these items regardless of the New Item Row visibility.
Column Header Menu
Users can right-click a column header to invoke this menu. Some items, however, can appear disabled, depending on the column’s settings.
The table below describes this menu’s items.
Menu Item | Description |
---|---|
Sort Ascending | Sorts data by the values of a column, in ascending order. The item is disabled if the context menu has been activated by clicking the header panel’s empty space. It is enabled if the clicked column’s TreeListOptionsColumn.AllowSort option is enabled. |
Sort Descending | Sorts data by the values of a column, in descending order. The item is disabled if the context menu has been activated by clicking the header panel’s empty space. It is enabled if the clicked column’s TreeListOptionsColumn.AllowSort option is enabled. |
Column Chooser | Invokes the Customization Form. |
Best Fit | Changes the width of a column to fit the contents of its cells (equivalent to calling the TreeListColumn.BestFit method for the column). It is disabled if the context menu has been activated by clicking the header panel’s empty space. |
Best Fit (all columns) | Changes the width of all columns to fit the contents of their cells (equivalent to calling the TreeList.BestFitColumns method). |
Group Summary Menu
Users can right-click a group summary in a group footer to invoke this menu. The menu allows the user to clear or apply a summary.
The table below describes this menu’s items.
Menu Item | Description |
---|---|
Sum | Calculates the sum of a column’s values. Available for numeric columns only. |
Min | Returns the minimum of the column’s values. |
Max | Returns the maximum of the column’s values. |
Count | Calculates the number of rows affected by the group summary. |
Average | Calculates the average of the column’s values. Available for numeric columns only. |
None | Cancels summary calculations. |
Total Summary Menu
Users can right-click a total summary in the summary footer to invoke this menu. The menu allows the user to clear or apply a summary.
The menu contains the same items as the Group Summary Menu plus one additional item:
Menu Item | Description |
---|---|
All Nodes | Switches the calculation of the current summary against all nodes, or only against root-level nodes. |