New to Telerik UI for WPFStart a free 30-day trial

Represents an item in a RadMenu or RadContextMenu. The RadMenuItem can be configured to display various visual states, handle commands, and accommodate submenu structures. It supports various properties including icons, headers, and checked states, thereby enhancing the flexibility and usability of menu navigation in WPF applications. The class implements ICommandSource interface to facilitate command binding and also inherits from HeaderedItemsControl to organize and manage child items hierarchically. The RadMenuItem is highly customizable through styling and template selection, allowing for tailored UI experiences.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.Navigation.dll

Syntax:

C#
[TelerikToolboxCategory("Navigation")]
public class RadMenuItem : HeaderedItemsControl, ICommandSource

Inheritance: objectRadMenuItem

Derived Classes: RadMenuGroupItemRadMenuSeparatorItemSeparatorMenuItemDropDownMenuItem

Implements: ICommandSource

Constructors

Initializes a new instance of the RadMenuItem class without menu text or a value.

C#
public RadMenuItem()

Fields

CheckedEvent

RoutedEvent

Identifies the Checked routed event.

C#
public static readonly RoutedEvent CheckedEvent

CheckedIconProperty

DependencyProperty

Identifies the CheckedIcon dependency property.

C#
public static readonly DependencyProperty CheckedIconProperty

CheckedIconTemplateProperty

DependencyProperty

Identifies the CheckedIconTemplate dependency property.

C#
public static readonly DependencyProperty CheckedIconTemplateProperty

ClickEvent

RoutedEvent

Identifies the Click routed event.

C#
public static readonly RoutedEvent ClickEvent

CommandParameterProperty

DependencyProperty

Identifies the CommandParameter dependency property.

C#
public static readonly DependencyProperty CommandParameterProperty

CommandProperty

DependencyProperty

Identifies the Command dependency property.

C#
public static readonly DependencyProperty CommandProperty

CommandTargetProperty

DependencyProperty

Identifies the CommandTarget property.

C#
public static readonly DependencyProperty CommandTargetProperty

DropDownHeightProperty

DependencyProperty

Identifies the DropDownHeight dependency property.

C#
public static readonly DependencyProperty DropDownHeightProperty

DropDownPlacementProperty

DependencyProperty

Identifies the DropDownPlacement dependency property.

C#
public static readonly DependencyProperty DropDownPlacementProperty

DropDownWidthProperty

DependencyProperty

Identifies the DropDownWidth dependency property.

C#
public static readonly DependencyProperty DropDownWidthProperty

IconColumnWidthProperty

DependencyProperty

Identifies the IconColumnWidth dependency property.

C#
public static readonly DependencyProperty IconColumnWidthProperty

IconProperty

DependencyProperty

Identifies the Icon dependency property.

C#
public static readonly DependencyProperty IconProperty

IconTemplateProperty

DependencyProperty

Identifies the IconTemplate dependency property.

C#
public static readonly DependencyProperty IconTemplateProperty

InputGestureTextProperty

DependencyProperty

Identifies the InputGestureText dependency property.

C#
public static readonly DependencyProperty InputGestureTextProperty

IsCheckableProperty

DependencyProperty

Identifies the IsCheckable dependency property.

C#
public static readonly DependencyProperty IsCheckableProperty

IsCheckedProperty

DependencyProperty

Identifies the IsChecked dependency property.

C#
public static readonly DependencyProperty IsCheckedProperty

IsCurrentProperty

DependencyProperty

Identifies the IsCurrent dependency property.

C#
public static readonly DependencyProperty IsCurrentProperty

IsHighlightedProperty

DependencyProperty

Identifies the IsHighlighted dependency property.

C#
public static readonly DependencyProperty IsHighlightedProperty

IsSeparatorProperty

DependencyProperty

Identifies the IsSeparatorProperty dependency property.

C#
public static readonly DependencyProperty IsSeparatorProperty

IsSubmenuOpenProperty

DependencyProperty

Identifies the IsSubmenuOpen dependency property.

C#
public static readonly DependencyProperty IsSubmenuOpenProperty

Identifies the IsSuspendingPopupAnimation readonly dependency property.

C#
public static readonly DependencyProperty IsSuspendingPopupAnimationProperty

Identifies the ItemContainerTemplateSelector dependency property.

C#
public static readonly DependencyProperty ItemContainerTemplateSelectorProperty

ItemIconPositionProperty

DependencyProperty

Identifies the ItemIconPosition dependency property.

C#
public static readonly DependencyProperty ItemIconPositionProperty

MenuProperty

DependencyProperty

Identifies the Menu readonly dependency property.

C#
public static readonly DependencyProperty MenuProperty

RoleProperty

DependencyProperty

Identifies the Role dependency property.

C#
public static readonly DependencyProperty RoleProperty

Identifies the SeparatorTemplateKey dependency property.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuSeparatorItem container and set its Template property.", false)]
public static readonly DependencyProperty SeparatorTemplateKeyProperty

StaysOpenOnClickProperty

DependencyProperty

Identifies the StaysOpenOnClick dependency property.

C#
public static readonly DependencyProperty StaysOpenOnClickProperty

Identifies the SubmenuClosed routed event.

C#
public static readonly RoutedEvent SubmenuClosedEvent

Identifies the SubmenuHeaderTemplateKey dependency property.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public static readonly DependencyProperty SubmenuHeaderTemplateKeyProperty

Identifies the SubmenuItemTemplateKey dependency property.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public static readonly DependencyProperty SubmenuItemTemplateKeyProperty

Identifies the SubmenuOpened routed event.

C#
public static readonly RoutedEvent SubmenuOpenedEvent

Identifies the TopLevelHeaderTemplateKey dependency property.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public static readonly DependencyProperty TopLevelHeaderTemplateKeyProperty

Identifies the TopLevelItemTemplateKey dependency property.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public static readonly DependencyProperty TopLevelItemTemplateKeyProperty

UncheckedEvent

RoutedEvent

Identifies the Unchecked routed event.

C#
public static readonly RoutedEvent UncheckedEvent

Properties

Gets or sets the icon that appears in a RadMenuItem when it is checkable and is checked. This is a dependency property.

C#
public object CheckedIcon { get; set; }

Gets or sets the data template used for the CheckedIcon. This is a dependency property.

C#
public DataTemplate CheckedIconTemplate { get; set; }

Gets the command that will be executed when the command source is invoked.

C#
[TypeConverter(typeof(CommandConverter))]
public ICommand Command { get; set; }

Represents a user defined data value that can be passed to the command when it is executed.

C#
public object CommandParameter { get; set; }

CommandTarget

IInputElement

The object that the command is being executed on.

C#
public IInputElement CommandTarget { get; set; }

Gets or sets the height of the drop-down area.

C#
public double DropDownHeight { get; set; }

Gets or sets the placement of the drop-down area.

C#
public MenuPlacementMode DropDownPlacement { get; set; }

Gets or sets the width of the drop-down area.

C#
public double DropDownWidth { get; set; }

Gets whether the control supports scrolling.

C#
protected override bool HandlesScrolling { get; }

Gets or sets the icon that appears in a RadMenuItem. This is a dependency property.

C#
[SRCategory("Appearance")]
public object Icon { get; set; }

Gets or sets the width of the column that contains the icon.

C#
public double IconColumnWidth { get; set; }

IconTemplate

DataTemplate

Gets or sets the data template used for Icon. This is a dependency property.

C#
public DataTemplate IconTemplate { get; set; }

Gets or sets the text describing an input gesture that will call the command tied to the specified item. This property does not associate the input gesture with the menu item. It simply adds text to the menu item. The application must handle the user's input to carry out the action.

C#
[Bindable(true)]
public string InputGestureText { get; set; }

Gets a value that indicates whether a RadMenuItem can be checked. This is a dependency property.

C#
[SRCategory("Behavior")]
public bool IsCheckable { get; set; }

Gets or sets a value that indicates whether the RadMenuItem is checked. This is a dependency property.

C#
[SRCategory("Appearance")]
public bool IsChecked { get; set; }

Gets or sets whether the item is current item.

C#
public bool IsCurrent { get; set; }

True if the RadMenuItem can be selected; otherwise, false.

C#
protected override bool IsEnabledCore { get; }

Gets a value that indicates whether a RadMenuItem is highlighted. This is a dependency property.

C#
[Browsable(false)]
[SRCategory("Appearance")]
public bool IsHighlighted { get; protected set; }

Gets or sets a value indicating whether this instance is a separator.

C#
public bool IsSeparator { get; set; }

Gets a value that indicates whether the submenu of the RadMenuItem is open. This is a dependency property.

C#
[Browsable(false)]
[SRCategory("Appearance")]
public bool IsSubmenuOpen { get; set; }

Gets whether a menu suspends animations on its Popup control.

C#
public bool IsSuspendingPopupAnimation { get; }

ItemContainerTemplateSelector

DataTemplateSelector

Gets or sets the custom logic for choosing a template used to display each item.

C#
public DataTemplateSelector ItemContainerTemplateSelector { get; set; }

Gets or sets the icon position for the icon. This is a dependency property.

C#
public ItemIconPosition ItemIconPosition { get; set; }

Gets the RadMenu for this RadMenuItem. This is a readonly dependency property.

C#
public MenuBase Menu { get; }

Gets a value that indicates the role of a RadMenuItem. This is a dependency property.

C#
[SRCategory("Behavior")]
public MenuItemRole Role { get; }

SeparatorTemplateKey

ControlTemplate

Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a separator.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuSeparatorItem container and set its Template property.", false)]
public ControlTemplate SeparatorTemplateKey { get; set; }

Gets or sets a value that indicates that the submenu in which this RadMenuItem is located should not close when this item is clicked. This is a dependency property.

C#
[SRCategory("Behavior")]
public bool StaysOpenOnClick { get; set; }

Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a header of a submenu.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public ControlTemplate SubmenuHeaderTemplateKey { get; set; }

SubmenuItemTemplateKey

ControlTemplate

Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a submenu.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public ControlTemplate SubmenuItemTemplateKey { get; set; }

Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a header of a top-level menu.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public ControlTemplate TopLevelHeaderTemplateKey { get; set; }

Gets the resource key for a style applied to a RadMenuItem when it is a top-level RadMenuItem.

C#
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public ControlTemplate TopLevelItemTemplateKey { get; set; }

Methods

Updates the visual state of the control.

C#
protected virtual void ChangeVisualState(bool useTransitions)
Parameters:useTransitionsbool

Indicates whether transitions should be used.

Clear the Menu property.

C#
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameters:elementDependencyObject

Element used to display the specified item.

itemobject

Specified item.

Creates or identifies the element that is used to display the given item.

C#
protected override DependencyObject GetContainerForItemOverride()
Returns:

DependencyObject

Determines if the specified item is RadMenuItem.

C#
protected override sealed bool IsItemItsOwnContainerOverride(object item)
Parameters:itemobject

The item to check.

Returns:

bool

True if the item is RadMenuItem; otherwise, false.

Determines if the specified item is RadMenuItem.

C#
protected virtual bool IsItemItsOwnContainerProtected(object item)
Parameters:itemobject

The item to check.

Returns:

bool

True if the item is RadMenuItem; otherwise, false.

Provides class handling for when an access key that is meaningful for this element is invoked.

C#
protected override void OnAccessKey(AccessKeyEventArgs e)
Parameters:eAccessKeyEventArgs

The event data to the access key event. The event data reports which key was invoked, and indicate whether the System.Windows.Input.AccessKeyManager object that controls the sending of these events also sent this access key invocation to other elements.

When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call .

C#
public override void OnApplyTemplate()

Called when the IsChecked property becomes true.

C#
protected virtual void OnChecked(RoutedEventArgs e)
Parameters:eRoutedEventArgs

The event data for the Checked event.

Called when a RadMenuItem is clicked and raises a Click event.

C#
protected virtual void OnClick()

Provides an appropriate RadMenuItemAutomationPeer implementation for this control, as part of the automation infrastructure.

C#
protected override AutomationPeer OnCreateAutomationPeer()
Returns:

AutomationPeer

Invoked when an unhandled Keyboard.GotKeyboardFocus attached event reaches an element in its route that is derived from this class.

C#
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters:eKeyboardFocusChangedEventArgs

The KeyboardFocusChangedEventArgs that contains the event data.

C#
protected override void OnHeaderChanged(object oldHeader, object newHeader)
Parameters:oldHeaderobjectnewHeaderobject
C#
protected override void OnHeaderTemplateChanged(DataTemplate oldHeaderTemplate, DataTemplate newHeaderTemplate)
Parameters:oldHeaderTemplateDataTemplatenewHeaderTemplateDataTemplate
C#
protected override void OnHeaderTemplateSelectorChanged(DataTemplateSelector oldHeaderTemplateSelector, DataTemplateSelector newHeaderTemplateSelector)
Parameters:oldHeaderTemplateSelectorDataTemplateSelectornewHeaderTemplateSelectorDataTemplateSelector

Raises the event. This method is invoked whenever is set to true internally.

C#
protected override void OnInitialized(EventArgs e)
Parameters:eEventArgs

The RoutedEventArgs that contains the event data.

Called when the focus is no longer on or within a RadMenuItem.

C#
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Parameters:eDependencyPropertyChangedEventArgs

The event data for the event.

Invoked when the property changes.

C#
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters:eNotifyCollectionChangedEventArgs

Information about the change.

Raises the event.

C#
protected override void OnKeyDown(KeyEventArgs e)
Parameters:eKeyEventArgs

The KeyEventArgs instance containing the event data.

Raises the event.

C#
protected override void OnMouseEnter(MouseEventArgs e)
Parameters:eMouseEventArgs

The MouseEventArgs instance containing the event data.

Raises the event.

C#
protected override void OnMouseLeave(MouseEventArgs e)
Parameters:eMouseEventArgs

The MouseEventArgs instance containing the event data.

Raises the event.

C#
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters:eMouseButtonEventArgs

The MouseButtonEventArgs instance containing the event data.

Raises the event.

C#
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters:eMouseButtonEventArgs

The MouseButtonEventArgs instance containing the event data.

Raises the event.

C#
protected override void OnMouseMove(MouseEventArgs e)
Parameters:eMouseEventArgs

The MouseEventArgs instance containing the event data.

Handles MouseRightButtonDown event.

C#
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
Parameters:eMouseButtonEventArgs

The MouseButtonEventArgs that contains the event data. The event data reports that the right mouse button was pressed.

Handles MouseRightButtonUp event.

C#
protected override void OnMouseRightButtonUp(MouseButtonEventArgs e)
Parameters:eMouseButtonEventArgs

The MouseButtonEventArgs that contains the event data. The event data reports that the right mouse button was released.

Called when the submenu of a RadMenuItem is closed.

C#
protected virtual void OnSubmenuClosed(RadRoutedEventArgs e)
Parameters:eRadRoutedEventArgs

The event data for the SubmenuClosed event.

Called when the submenu of a RadMenuItem is opened.

C#
protected virtual void OnSubmenuOpened(RadRoutedEventArgs e)
Parameters:eRadRoutedEventArgs

The event data for the SubmenuOpened event.

Called when the IsChecked property becomes false.

C#
protected virtual void OnUnchecked(RoutedEventArgs e)
Parameters:eRoutedEventArgs

The event data for the Unchecked event.

Prepares the specified element to display the specified item.

C#
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters:elementDependencyObject

Element used to display the specified item.

itemobject

Specified item.

Resets the theme.

C#
public void ResetTheme()

Events

Checked

RoutedEventHandler

Occurs when a RadMenuItem is checked.

C#
[SRCategory("Behavior")]
public event RoutedEventHandler Checked

Occurs when a RadMenuItem is clicked.

C#
[SRCategory("Behavior")]
public event RadRoutedEventHandler Click

Occurs when the state of the IsSubmenuOpen property changes to false.

C#
[SRCategory("Behavior")]
public event RadRoutedEventHandler SubmenuClosed

Occurs when the state of the IsSubmenuOpen property changes to true.

C#
[SRCategory("Behavior")]
public event RadRoutedEventHandler SubmenuOpened

Unchecked

RoutedEventHandler

Occurs when a RadMenuItem is unchecked.

C#
[SRCategory("Behavior")]
public event RoutedEventHandler Unchecked
In this article
DefinitionConstructorsRadMenuItem()FieldsCheckedEventCheckedIconPropertyCheckedIconTemplatePropertyClickEventCommandParameterPropertyCommandPropertyCommandTargetPropertyDropDownHeightPropertyDropDownPlacementPropertyDropDownWidthPropertyIconColumnWidthPropertyIconPropertyIconTemplatePropertyInputGestureTextPropertyIsCheckablePropertyIsCheckedPropertyIsCurrentPropertyIsHighlightedPropertyIsSeparatorPropertyIsSubmenuOpenPropertyIsSuspendingPopupAnimationPropertyItemContainerTemplateSelectorPropertyItemIconPositionPropertyMenuPropertyRolePropertySeparatorTemplateKeyPropertyStaysOpenOnClickPropertySubmenuClosedEventSubmenuHeaderTemplateKeyPropertySubmenuItemTemplateKeyPropertySubmenuOpenedEventTopLevelHeaderTemplateKeyPropertyTopLevelItemTemplateKeyPropertyUncheckedEventPropertiesCheckedIconCheckedIconTemplateCommandCommandParameterCommandTargetDropDownHeightDropDownPlacementDropDownWidthHandlesScrollingIconIconColumnWidthIconTemplateInputGestureTextIsCheckableIsCheckedIsCurrentIsEnabledCoreIsHighlightedIsSeparatorIsSubmenuOpenIsSuspendingPopupAnimationItemContainerTemplateSelectorItemIconPositionMenuRoleSeparatorTemplateKeyStaysOpenOnClickSubmenuHeaderTemplateKeySubmenuItemTemplateKeyTopLevelHeaderTemplateKeyTopLevelItemTemplateKeyMethodsChangeVisualState(bool)ClearContainerForItemOverride(DependencyObject, object)GetContainerForItemOverride()IsItemItsOwnContainerOverride(object)IsItemItsOwnContainerProtected(object)OnAccessKey(AccessKeyEventArgs)OnApplyTemplate()OnChecked(RoutedEventArgs)OnClick()OnCreateAutomationPeer()OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)OnHeaderChanged(object, object)OnHeaderTemplateChanged(DataTemplate, DataTemplate)OnHeaderTemplateSelectorChanged(DataTemplateSelector, DataTemplateSelector)OnInitialized(EventArgs)OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)OnItemsChanged(NotifyCollectionChangedEventArgs)OnKeyDown(KeyEventArgs)OnMouseEnter(MouseEventArgs)OnMouseLeave(MouseEventArgs)OnMouseLeftButtonDown(MouseButtonEventArgs)OnMouseLeftButtonUp(MouseButtonEventArgs)OnMouseMove(MouseEventArgs)OnMouseRightButtonDown(MouseButtonEventArgs)OnMouseRightButtonUp(MouseButtonEventArgs)OnSubmenuClosed(RadRoutedEventArgs)OnSubmenuOpened(RadRoutedEventArgs)OnUnchecked(RoutedEventArgs)PrepareContainerForItemOverride(DependencyObject, object)ResetTheme()EventsCheckedClickSubmenuClosedSubmenuOpenedUnchecked
Not finding the help you need?
Contact Support