Edit this page

Context Menus

To implement context menus use RadContextMenu in your application. RadContextMenu is a non-visual component that sits in the component tray located below the form design surface. RadContextMenu, like RadMenu, can be themed and has an items collection that accepts RadMenuItem, RadMenuComboBoxItem, RadMenuSeparatorItem and RadMenuContextItem.

Figure 1: RadContextMenu

menus-context-menu-getting-started 001

There are two ways to attach a context menu to a given control or portion of a control:

  • For those RadControls that have a ContextMenu or RadContextMenu properties you can assign the RadContextMenu in the designer or in code.

Assigning a RadContextMenu

radTreeView1.Nodes[0].ContextMenu = radContextMenu1;

RadTreeView1.Nodes(0).ContextMenu = RadContextMenu1


The ContextMenuStrip property refers to a Windows standard control. This property drop down will not display RadMenu or RadContextMenu components that exist on the form.

  • Handle the mouse down event for the control that requires the context menu and call the RadContextMenu.Show() method.

Handling the MouseDown event

void radCalendar1_MouseDown(object sender, MouseEventArgs e)
    if (e.Button == MouseButtons.Right)
        Point p = (sender as Control).PointToScreen(e.Location);
        radContextMenu1.Show(p.X, p.Y);

Private Sub radCalendar1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
    If e.Button = MouseButtons.Right Then
        Dim p As Point = (TryCast(sender, Control)).PointToScreen(e.Location)
        RadContextMenu1.Show(p.X, p.Y)
    End If
End Sub

See Also

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article