Distinguishing the Source Control of RadContextMenu
Environment
Product Version | 2018.1 220 |
Product | RadContextMenu for WinForms |
Description
The RadContextMenuManager component allows a single RadContextMenu instance to be associated with various controls. This KB article demonstrates a way to distinguish the source control of the menu. It may be useful in a scenario requiring the menu items need to be dynamically changed or different actions be invoked upon clicking the menu items. The example assumes that two different RadListView controls are using the same RadContextMenu. Additional information about the RadContextMenuManager component is available here: https://docs.telerik.com/devtools/winforms/menus/contextmenu/assign-radcontextmenu-to-telerik-and-non-telerik-controls.
Solution
The source control will be extracted from the element`s visual tree and stored in a variable so that it can be validated upon clicking the menu items.
Figure 1: Single Context Menu