New to Telerik UI for WinFormsStart a free 30-day trial

Provides a component that adds the RadContextMenu dynamic property to controls and enables using RadContextMenu with any control that supports context menus. This manager handles the association between controls and their context menus.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
[TelerikToolboxCategory("Menus & Toolbars")]
[ToolboxBitmap(typeof(RadContextMenu), "RadContextMenuManager.bmp")]
public class RadContextMenuManager : Component, IComponent, IDisposable, IExtenderProvider

Inheritance: objectMarshalByRefObjectComponentRadContextMenuManager

Implements: IComponentIDisposableIExtenderProvider

Constructors

C#
public RadContextMenuManager()

Methods

Determines whether this extender provider can extend the specified target component with context menu functionality. This method excludes RadTreeView and RadTextBoxControl as they have their own context menu implementations.

C#
public bool CanExtend(object extendee)
Parameters:extendeeobject

The target object to be extended with context menu functionality.

Returns:

bool

true if this extender can extend the specified target component; otherwise, false.

Implements: IExtenderProvider.CanExtend(object)

Gets the RadContextMenu that is currently associated with the specified control. This method retrieves the context menu that was previously set using SetRadContextMenu(Control, RadContextMenu).

C#
public RadContextMenu GetRadContextMenu(Control control)
Parameters:controlControl

The control for which to retrieve the associated RadContextMenu.

Returns:

RadContextMenu

The RadContextMenu associated with the control, or null if no menu is associated.

Associates a RadContextMenu with the specified control and automatically handles right-click events to display the context menu. When a menu is set, the control's MouseDown event is subscribed to handle context menu display. When set to null, the event subscription is removed.

C#
public void SetRadContextMenu(Control control, RadContextMenu value)
Parameters:controlControl

The control to associate with the RadContextMenu.

valueRadContextMenu

The RadContextMenu to associate with the control, or null to remove the association.