skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class RadContextMenu

Represents a context menu control that enables you to hierarchically organize elements with associated event handlers.

Inheritance
System.Object
MenuBase
RadContextMenu
OverflowMenu
DropDownMenu
Inherited Members
MenuBase.ItemContainerTemplateSelectorProperty
MenuBase.IconColumnWidthProperty
MenuBase.ClickToOpenProperty
MenuBase.ShowDelayProperty
MenuBase.HideDelayProperty
MenuBase.NotifyOnHeaderClickProperty
MenuBase.add_ItemClick(RadRoutedEventHandler)
MenuBase.remove_ItemClick(RadRoutedEventHandler)
MenuBase.OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
MenuBase.GetContainerForItemOverride()
MenuBase.IsItemItsOwnContainerOverride(Object)
MenuBase.IsItemItsOwnContainerProtected(Object)
MenuBase.OnItemClick(RadRoutedEventArgs)
MenuBase.OnLoaded(RoutedEventArgs)
MenuBase.NotifyOnHeaderClick
MenuBase.ClickToOpen
MenuBase.IconColumnWidth
MenuBase.ShowDelay
MenuBase.HideDelay
MenuBase.ItemContainerTemplateSelector
MenuBase.ItemClick
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.Navigation.dll

Syntax

[TelerikToolboxCategory("Navigation")]
public class RadContextMenu : MenuBase, IPopupAware

Constructors

RadContextMenu()

Initializes a new instance of the RadContextMenu class.

Declaration
public RadContextMenu()

Fields

AttachOnHandledEventsProperty

Identifies the AttachOnHandledEvents dependency property.

Declaration
public static readonly DependencyProperty AttachOnHandledEventsProperty
Field Value
System.Windows.DependencyProperty

ClosedEvent

Identifies the Closed routed event.

Declaration
public static readonly RoutedEvent ClosedEvent
Field Value
System.Windows.RoutedEvent

ContextMenuProperty

Identifies the RadContextMenu attached property.

Declaration
public static readonly DependencyProperty ContextMenuProperty
Field Value
System.Windows.DependencyProperty

EventNameProperty

Identifies the EventName dependency property.

Declaration
public static readonly DependencyProperty EventNameProperty
Field Value
System.Windows.DependencyProperty

HorizontalOffsetProperty

Identifies the HorizontalOffset dependency property.

Declaration
public static readonly DependencyProperty HorizontalOffsetProperty
Field Value
System.Windows.DependencyProperty

InheritDataContextProperty

Identifies the InheritDataContext dependency property.

Declaration
public static readonly DependencyProperty InheritDataContextProperty
Field Value
System.Windows.DependencyProperty

IsOpenProperty

Identifies the IsOpen dependency property.

Declaration
public static readonly DependencyProperty IsOpenProperty
Field Value
System.Windows.DependencyProperty

ModifierKeyProperty

Identifies the ModifierKey dependency property.

Declaration
public static readonly DependencyProperty ModifierKeyProperty
Field Value
System.Windows.DependencyProperty

OpenedEvent

Identifies the Opened routed event.

Declaration
public static readonly RoutedEvent OpenedEvent
Field Value
System.Windows.RoutedEvent

OpeningEvent

Identifies the Opening routed event.

Declaration
public static readonly RoutedEvent OpeningEvent
Field Value
System.Windows.RoutedEvent

PlacementProperty

Identifies the Placement dependency property.

Declaration
public static readonly DependencyProperty PlacementProperty
Field Value
System.Windows.DependencyProperty

PlacementRectangleProperty

Identifies the PlacementRectangle dependency property.

Declaration
public static readonly DependencyProperty PlacementRectangleProperty
Field Value
System.Windows.DependencyProperty

PlacementTargetProperty

Identifies the PlacementTarget dependency property.

Declaration
public static readonly DependencyProperty PlacementTargetProperty
Field Value
System.Windows.DependencyProperty

RestoreFocusToTargetElementProperty

Identifies the RestoreFocusToTargetElement dependency property.

Declaration
public static readonly DependencyProperty RestoreFocusToTargetElementProperty
Field Value
System.Windows.DependencyProperty

ShowKeyboardCuesOnOpenProperty

Identifies the ShowKeyboardCuesOnOpen dependency property.

Declaration
public static readonly DependencyProperty ShowKeyboardCuesOnOpenProperty
Field Value
System.Windows.DependencyProperty

StaysOpenProperty

Identifies the StaysOpen dependency property.

Declaration
public static readonly DependencyProperty StaysOpenProperty
Field Value
System.Windows.DependencyProperty

UIElementProperty

Identifies the UIElement read-only dependency property.

Declaration
public static readonly DependencyProperty UIElementProperty
Field Value
System.Windows.DependencyProperty

VerticalOffsetProperty

Identifies the VerticalOffset dependency property.

Declaration
public static readonly DependencyProperty VerticalOffsetProperty
Field Value
System.Windows.DependencyProperty

Properties

AttachOnHandledEvents

Gets or sets whether RadContextMenu will open on handled routed events. The default value is false. This is a dependency property.

Declaration
public bool AttachOnHandledEvents { get; set; }
Property Value
System.Boolean

EventName

Gets or sets the name of the event that will open the context menu.

Declaration
public string EventName { get; set; }
Property Value
System.String

The name of the event.

HandlesScrolling

Gets whether the control supports scrolling.

Declaration
protected override bool HandlesScrolling { get; }
Property Value
System.Boolean

HorizontalOffset

Get or sets the horizontal distance between the target origin and the popup alignment point. This is a dependency property.

Declaration
public double HorizontalOffset { get; set; }
Property Value
System.Double

InheritDataContext

Get or sets whether RadContextMenu will inherit DataContext of the element on which it is attached. This is a dependency property.

Declaration
public bool InheritDataContext { get; set; }
Property Value
System.Boolean

IsOpen

Gets or sets a value that indicates whether the RadContextMenu is visible. This is a dependency property.

Declaration
public bool IsOpen { get; set; }
Property Value
System.Boolean

ModifierKey

Gets or sets a ModifierKey that should be pressed when EventName event occurs to open the RadContextMenu. This is a dependency property.

Declaration
public ModifierKeys ModifierKey { get; set; }
Property Value
System.Windows.Input.ModifierKeys

MousePosition

Gets the position of the mouse at the moment when the menu was opened relative to the element that caused RadContextMenu to open. Returns Point(double.NaN, double.NaN) if context menu is closed or if the event caused context menu Opened is not Mouse event (e.g. not MouseRightButtonUp, MouseLeftButtonUp, etc.).

Declaration
public Point MousePosition { get; }
Property Value
System.Windows.Point

Placement

Gets or sets the Placement property of a RadContextMenu. This is a dependency property.

Declaration
public PlacementMode Placement { get; set; }
Property Value
System.Windows.Controls.Primitives.PlacementMode

PlacementRectangle

Gets or sets the area relative to which the context menu is positioned when it opens. This is a dependency property.

Declaration
public Rect PlacementRectangle { get; set; }
Property Value
System.Windows.Rect

PlacementTarget

Gets or sets the PlacementTarget. This is a dependency property.

Declaration
public UIElement PlacementTarget { get; set; }
Property Value
System.Windows.UIElement

RestoreFocusToTargetElement

Gets or sets a value indicating whether the focus should be returned to the target UIElement when menu is closed.

Declaration
public bool RestoreFocusToTargetElement { get; set; }
Property Value
System.Boolean

ShowKeyboardCuesOnOpen

Gets or sets a value indicating whether the keyboard cues should be shown when the menu is opened. Default value is null - keyboard cues will be auto shown when the menu is opened through the keyboard. If set to true keyboard cues will be always shown and if set to false will be never shown when opened.

Declaration
public Nullable<bool> ShowKeyboardCuesOnOpen { get; set; }
Property Value
System.Nullable<System.Boolean>

StaysOpen

Gets or sets a value that indicates whether the RadContextMenu should close automatically. This is a dependency property.

Declaration
public bool StaysOpen { get; set; }
Property Value
System.Boolean

UIElement

Gets the element on which RadContextMenu is attached.

Declaration
public UIElement UIElement { get; }
Property Value
System.Windows.UIElement

VerticalOffset

Get or sets the vertical distance between the target origin and the popup alignment point. This is a dependency property.

Declaration
public double VerticalOffset { get; set; }
Property Value
System.Double

Methods

add_Opening(RadRoutedEventHandler)

Declaration
public void add_Opening(RadRoutedEventHandler value)
Parameters
RadRoutedEventHandler value

ClearContainerForItemOverride(DependencyObject, Object)

When overridden in a derived class, undoes the effects of the System.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(System.Windows.DependencyObject,System.Object) method.

Declaration
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameters
System.Windows.DependencyObject element

The container element.

System.Object item

The Item.

Overrides
MenuBase.ClearContainerForItemOverride(DependencyObject, Object)

GetClickedElement<T>()

Returns the first element of the given type at the click point coordinates.

Declaration
public T GetClickedElement<T>()
    where T : FrameworkElement
Returns
T

Type Parameters
T

The type of the element to be returned.

GetContextMenu(FrameworkElement)

Gets the value of the ContextMenu property of the specified element.

Declaration
public static RadContextMenu GetContextMenu(FrameworkElement element)
Parameters
System.Windows.FrameworkElement element

Returns
RadContextMenu

OnApplyTemplate()

Called when the template for the RadContextMenu is applied, allowing customization of the visual presentation of the context menu elements.

Declaration
public override void OnApplyTemplate()

OnClosed(RadRoutedEventArgs)

Called when the Closed event occurs.

Declaration
protected virtual void OnClosed(RadRoutedEventArgs e)
Parameters
RadRoutedEventArgs e

OnCreateAutomationPeer()

Creates a new AutomationPeer for this RadContextMenu.

Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
System.Windows.Automation.Peers.AutomationPeer

OnInitialized(EventArgs)

Raises the System.Windows.FrameworkElement.Initialized event. This method is invoked whenever System.Windows.FrameworkElement.IsInitialized is set to true internally.

Declaration
protected override void OnInitialized(EventArgs e)
Parameters
System.EventArgs e

The System.Windows.RoutedEventArgs that contains the event data.

OnKeyDown(KeyEventArgs)

Invoked when keyboard key is pressed while the element has focus.

Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
System.Windows.Input.KeyEventArgs e

The KeyEventArgs that contains the event data.

Overrides
MenuBase.OnKeyDown(KeyEventArgs)

OnKeyUp(KeyEventArgs)

Invoked when keyboard key is released while the element has focus.

Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
System.Windows.Input.KeyEventArgs e

The KeyEventArgs that contains the event data.

OnOpened(RadRoutedEventArgs)

Called when the Opened event occurs.

Declaration
protected virtual void OnOpened(RadRoutedEventArgs e)
Parameters
RadRoutedEventArgs e

PrepareContainerForItemOverride(DependencyObject, Object)

Prepares the specified element to display the specified item.

Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
System.Windows.DependencyObject element

Element used to display the specified item.

System.Object item

Specified item.

Overrides
MenuBase.PrepareContainerForItemOverride(DependencyObject, Object)

remove_Opening(RadRoutedEventHandler)

Declaration
public void remove_Opening(RadRoutedEventHandler value)
Parameters
RadRoutedEventHandler value

SetContextMenu(FrameworkElement, RadContextMenu)

Sets the value of the ContextMenu property of the specified element.

Declaration
public static void SetContextMenu(FrameworkElement element, RadContextMenu value)
Parameters
System.Windows.FrameworkElement element

RadContextMenu value

Events

Closed

Occurs when a particular instance of a RadContextMenu closes.

Declaration
public event RoutedEventHandler Closed
Event Type
System.Windows.RoutedEventHandler

Opened

Occurs when a particular instance of a RadContextMenu opens.

Declaration
public event RoutedEventHandler Opened
Event Type
System.Windows.RoutedEventHandler

Opening

Occurs before particular instance of RadContextMenu opens. If it is handled then RadContextMenu will not open.

Declaration
public event RadRoutedEventHandler Opening
Event Type
RadRoutedEventHandler

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.