# ContextMenu

You can display a context menu when the user interacts with the notify icon with the help of the **TrayContextMenu** property.

## TrayContextMenu

The **TrayContextMenu** property expects a value of type [RadContextMenu](https://www.telerik.com/products/winforms/documentation/controls/menus/contextmenu/context-menus). **Example 1** demonstrates how it can be used.

```C#
void SetContextMenu()
{
    RadNotifyIcon radNotifyIcon = new RadNotifyIcon();
    radNotifyIcon.TrayIcon = new System.Drawing.Icon("../../WinForms128x28.ico");
    radNotifyIcon.ContextMenuActivationMouseEvent = MouseActivationEvent.RightClick;
    radNotifyIcon.ShowTrayIcon = true;
    radNotifyIcon.PopupContent = new UserControl1();
    var contextMenu = new RadContextMenu();
    contextMenu.Items.Add(new RadMenuItem("Item 1"));
    contextMenu.Items.Add(new RadMenuItem("Item 2"));
    contextMenu.Items.Add(new RadMenuItem("Item 3"));
    radNotifyIcon.TrayContextMenu = contextMenu;
}
```

```VB.NET
Private Sub SetContextMenu()
    Dim radNotifyIcon As RadNotifyIcon = New RadNotifyIcon()
    radNotifyIcon.TrayIcon = New System.Drawing.Icon("../../WinForms128x28.ico")
    radNotifyIcon.ContextMenuActivationMouseEvent = MouseActivationEvent.RightClick
    radNotifyIcon.ShowTrayIcon = True
    radNotifyIcon.PopupContent = New UserControl1()
    Dim contextMenu = New RadContextMenu()
    contextMenu.Items.Add(New RadMenuItem("Item 1"))
    contextMenu.Items.Add(New RadMenuItem("Item 2"))
    contextMenu.Items.Add(New RadMenuItem("Item 3"))
    radNotifyIcon.TrayContextMenu = contextMenu
End Sub
```

#### **Figure 1: RadContextMenu displayed over the icon**

![RadContextMenu displayed over the icon](https://www.telerik.com/products/winforms/documentation/assets/a37d576ac61cfe202ceda0f4d3aec35b/radnotifyicon-features-contextmenu.png)

## ContextMenuActivationMouseEvent

The **ContextMenuActivationMouseEvent** property determines when the context menu will be shown. The default value is **RightClick**. This property is enumeration and it expose the following values:

* **LeftClick**: Triggered on left mouse click.
* **RightClick**: Triggered on right mouse click.
* **MiddleClick**: Triggered on middle mouse click.
* **LeftDoubleClick**: Triggered on left mouse double click.
* **RightDoubleClick**: Triggered on right mouse double click.
* **MiddleDoubleClick**: Triggered on middle mouse double click.
* **All**: Triggered on any mouse click action.

```C#
this.radNotifyIcon.ContextMenuActivationMouseEvent = MouseActivationEvent.MiddleClick;
```

```VB.NET
Me.radNotifyIcon.ContextMenuActivationMouseEvent = MouseActivationEvent.MiddleClick
```
