# Getting Started

This tutorial walks you through the creation of a **RadContextMenu**.

> note Before reading this tutorial you should get familiar with the [Visual Structure](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/visual-structure) of the standard **RadContextMenu** control.

## Adding Telerik Assemblies Using NuGet

To use **RadContextMenu** when working with NuGet packages, install the `Telerik.Windows.Controls.Navigation.for.Wpf.Xaml` package. The [package name may vary](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/available-packages) slightly based on the Telerik dlls set - [Xaml or NoXaml](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/xaml-vs-noxaml)

Read more about NuGet installation in the [Installing UI for WPF from NuGet Package](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/nuget-installation) article.

> tip With the 2025 Q1 release, the Telerik UI for WPF has a new licensing mechanism. Learn more in [Installing the License Key](https://www.telerik.com/products/wpf/documentation/installation/licensing/installing-license-key).

## Adding Assembly References Manually

If you are not using NuGet packages, you can add a reference to the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.Windows.Controls**
* **Telerik.Windows.Controls.Navigation**

You can find the required assemblies for each control from the suite in the [Controls Dependencies](https://www.telerik.com/products/wpf/documentation/common-information/installation-installing-dependencies-wpf) help article.

## Attaching Context Menu to UI Element

In order to add a **RadContextMenu** control to your **UserControl** you have to declare the following namespace:

**Declare the Telerik Namespace**

```XAML
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
```

This tutorial will show you how to attach a **RadContextMenu** to a TextBox control. Here is the TextBox control definition.

**Define the TextBox**

```XAML
<Grid x:Name="LayoutRoot"
      Background="White">
    <TextBox x:Name="InputBox"
             Width="200"
             VerticalAlignment="Top">
    </TextBox>
</Grid>
```

The next step is to set the **ContextMenu** attached property of the **RadContextMenu** class to the **TextBox** control.

> note *ContextMenu="{x:Null}"* is needed to override the default context menu of the textbox.

**Attach RadContextMenu to the TextBox**

```XAML
<Grid xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    Background="White">
    <TextBox Width="200"
             VerticalAlignment="Top"
             ContextMenu="{x:Null}">
        <telerik:RadContextMenu.ContextMenu>
            <telerik:RadContextMenu />
        </telerik:RadContextMenu.ContextMenu>
    </TextBox>
</Grid>
```

If you run the application and right-click on the TextBox you will see an empty context menu.

> caption RadContextMenu with an empty context menu

![WPF RadContextMenu with Empty Context Menu](https://www.telerik.com/products/wpf/documentation/assets/331050d0ccfca9dde7efb2e562143de7/radcontextmenu_getting_started_01.png)

## Adding Menu Items

> note The class that represents the menu item is **Telerik.Windows.Controls.RadMenuItem**. To learn more about it, please take a look at the [RadMenu help content](https://www.telerik.com/products/wpf/documentation/controls/radmenu/overview).

The **RadContextMenu** accepts **RadMenuItems** as child items. Here is a sample declaration of several child menu items.

**Define RadMenuItems**

```XAML
<TextBox xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
         Width="200"
         VerticalAlignment="Top"
         ContextMenu="{x:Null}">
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu>
            <telerik:RadMenuItem Header="Copy" />
            <telerik:RadMenuItem Header="Paste" />
            <telerik:RadMenuItem Header="Cut" />
            <telerik:RadMenuItem IsSeparator="True" />
            <telerik:RadMenuItem Header="Select All" />
        </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
</TextBox>
```

Here is a snapshot of the result.

> caption RadContextMenu with menu items

![WPF RadContextMenu with Populated Context Menu](https://www.telerik.com/products/wpf/documentation/assets/9b0cfbb966aaf3695b777cc58f97c7eb/radcontextmenu_getting_started_02.png)

## Populating the RadContextMenu with Data

The scenario described in the previous sections covers the usage of static items, declared directly in XAML.

However, in most of the cases you have to bind your **RadContextMenu** to a collection of business objects. Check out the [Data Binding](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/data-binding) article which describes in detail how to work with dynamic data, including the supported data sources and the **ItemContainerStyle** mechanism.

To adjust the appearance of the **RadContextMenu's** items depending on the data they hold, read the [Item Template and Style Selectors](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/template-and-style-selectors) article.

## Working with the RadContextMenu

In order to learn how to use the **RadContextMenu** and what capabilities it holds, read the various topics that describe its features.

* [Setting the Opening Event](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/opening-on-specific-event)

* [Keyboard Support](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/key-modifiers)

* [Menu Placement](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/placement)

* [Opening and Closing Delays](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/opening-and-closing-delays)

* [Data Binding](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/data-binding)

* [Item Template and Style Selectors](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/template-and-style-selectors)

* [Context Menu Owner](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/context-menu-owner)

* [Customizing the Icon Column](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/icon-column)

## Telerik UI for WPF Learning Resources

* [Telerik UI for WPF ContextMenu Component](https://www.telerik.com/products/wpf/contextmenu.aspx)
* [Getting Started with Telerik UI for WPF Components](https://www.telerik.com/products/wpf/documentation/getting-started/first-steps-nuget)
* [Telerik UI for WPF Installation](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/installation-guide)
* [Telerik UI for WPF and WinForms Integration](https://www.telerik.com/products/wpf/documentation/common-information/winforms-integration/overview)
* [Telerik UI for WPF Visual Studio Templates](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/visual-studio-templates)
* [Setting a Theme with Telerik UI for WPF](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview)
* [Telerik UI for WPF Virtual Classroom (Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/16/telerik-ui-for-wpf)
* [Telerik UI for WPF License Agreement](https://www.telerik.com/purchase/license-agreement/wpf-dlw-s)

## See Also

* [Visual Structure](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/visual-structure)

* [Events - Overview](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/events)

* [Item Template and Style Selectors](https://www.telerik.com/products/wpf/documentation/controls/radcontextmenu/template-and-style-selectors)

* [Use RadContextMenu with a RadGridView](https://www.telerik.com/products/wpf/documentation/knowledge-base/kb-contextmenu-use-with-radgridview)

* [Select the Clicked Item of a RadTreeView](https://www.telerik.com/products/wpf/documentation/knowledge-base/kb-contextmenu-select-clicked-item-radtreeview)

* [Create Menu Button with RadContextMenu and ToggleButton](https://www.telerik.com/products/wpf/documentation/knowledge-base/kb-contextmenu-create-menu-button-with-togglebutton)

* [Use Commands with the RadContextMenu](https://www.telerik.com/products/wpf/documentation/knowledge-base/kb-contextmenu-use-commands)

* [Handle Item Clicks](https://www.telerik.com/products/wpf/documentation/knowledge-base/kb-contextmenu-handle-item-clicks)
