New to Telerik UI for WPF? Start a free 30-day trial

Context Menu Owner

Updated on Sep 28, 2026

The RadContextMenu provides properties and methods for working with the UI element that opened it. You can access the owner, determine the mouse position, retrieve a clicked item from the event route, and restore focus to the owner after the menu closes.

Access the Context Menu Owner

The UIElement property returns the element to which the RadContextMenu is attached. The MousePosition property returns the mouse position relative to the element that caused the menu to open.

Access the Context Menu Owner and Mouse Position

C#
UIElement owner = this.radContextMenu.UIElement;
Point position = this.radContextMenu.MousePosition;

Use the owner and position information when a command needs to update the element that opened the menu or interpret the location of the click.

Get the Clicked Element

When an element gets clicked and the RadContextMenu appears, you can use the GetClickedElement<T>() method to retrieve the first element of type T in the visual tree that is part of the route of the event that opened the menu.

For example, if you have a RadTreeView with a RadContextMenu attached, handle the Opened event to retrieve the RadTreeViewItem that was clicked.

Get the Clicked Element in C#

C#
private void RadContextMenu_Opened(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    RadContextMenu contextMenu = (RadContextMenu)sender;
    RadTreeViewItem item = contextMenu.GetClickedElement<RadTreeViewItem>();
}

The returned RadTreeViewItem is the item that opened the context menu.

More complex examples are available in Using RadContextMenu within RadGridView and Selecting the Clicked Item of a RadTreeView.

Restore Focus to the Context Menu Owner

When opened, the RadContextMenu automatically receives focus. Set RestoreFocusToTargetElement to True to return focus to the element that opened the menu after it closes.

Restore Focus to the Context Menu Owner

XAML
<telerik:RadContextMenu xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                        RestoreFocusToTargetElement="True" />

See Also