Control the Availability of Standard Context Menus to Users
- 2 minutes to read
There are two ways to control the availability of the standard context menus to end-users: via corresponding options and by handling an event.
#Control the Display of Menus via Options
Menu options that control the availability of the standard context menus can be accessed via the TreeList.OptionsMenu property. These options allow you to disable or enable the column header and footer menus. Note that the Tree List elements for which menus are activated must be visible to allow the menus to be invoked. The visibility of these elements is controlled by the view options that can be accessed via the TreeList.OptionsView property.
The table below lists the types of menu and their visibility conditions.
Menu Type | Visibility Condition |
---|---|
Column Header Panel Menu | The Tree |
Row Footer Menu | The Tree |
Summary Footer Menu | The Tree |
Node Menu | The Tree |
For instance, you can write the following code to enable the column header menu and disable the footer menus.
treeList1.OptionsMenu.EnableColumnMenu = true;
treeList1.OptionsMenu.EnableFooterMenu = false;
#Control the Display of Menus via Event
The TreeList.PopupMenuShowing event fires each time an end-user attempts to invoke any standard context menu. The event’s parameters allow you to identify the type of menu, customize the menu or prevent it from being invoked. The following sample code handles the TreeList.PopupMenuShowing event to prohibit the menu for the Department column from being invoked.