ClassRadMenuItem
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:
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
[TelerikToolboxCategory("Navigation")]
public class RadMenuItem : HeaderedItemsControl, ICommandSource
Inheritance: objectRadMenuItem
Derived Classes:
Implements:
Constructors
RadMenuItem()
Initializes a new instance of the RadMenuItem class without menu text or a value.
Declaration
public RadMenuItem()
Fields
CheckedEvent
Identifies the Checked routed event.
Declaration
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly RoutedEvent CheckedEvent
Field Value
RoutedEvent
CheckedIconProperty
Identifies the CheckedIcon dependency property.
Declaration
public static readonly DependencyProperty CheckedIconProperty
Field Value
DependencyProperty
CheckedIconTemplateProperty
Identifies the CheckedIconTemplate dependency property.
Declaration
public static readonly DependencyProperty CheckedIconTemplateProperty
Field Value
DependencyProperty
ClickEvent
Identifies the Click routed event.
Declaration
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly RoutedEvent ClickEvent
Field Value
RoutedEvent
CommandParameterProperty
Identifies the CommandParameter dependency property.
Declaration
public static readonly DependencyProperty CommandParameterProperty
Field Value
DependencyProperty
CommandProperty
Identifies the Command dependency property.
Declaration
public static readonly DependencyProperty CommandProperty
Field Value
DependencyProperty
CommandTargetProperty
Identifies the CommandTarget property.
Declaration
public static readonly DependencyProperty CommandTargetProperty
Field Value
DependencyProperty
DropDownHeightProperty
Identifies the DropDownHeight dependency property.
Declaration
public static readonly DependencyProperty DropDownHeightProperty
Field Value
DependencyProperty
DropDownPlacementProperty
Identifies the DropDownPlacement dependency property.
Declaration
public static readonly DependencyProperty DropDownPlacementProperty
Field Value
DependencyProperty
DropDownWidthProperty
Identifies the DropDownWidth dependency property.
Declaration
public static readonly DependencyProperty DropDownWidthProperty
Field Value
DependencyProperty
IconColumnWidthProperty
Identifies the IconColumnWidth dependency property.
Declaration
public static readonly DependencyProperty IconColumnWidthProperty
Field Value
DependencyProperty
IconProperty
Identifies the Icon dependency property.
Declaration
public static readonly DependencyProperty IconProperty
Field Value
DependencyProperty
IconTemplateProperty
Identifies the IconTemplate dependency property.
Declaration
public static readonly DependencyProperty IconTemplateProperty
Field Value
DependencyProperty
InputGestureTextProperty
Identifies the InputGestureText dependency property.
Declaration
public static readonly DependencyProperty InputGestureTextProperty
Field Value
DependencyProperty
IsCheckableProperty
Identifies the IsCheckable dependency property.
Declaration
public static readonly DependencyProperty IsCheckableProperty
Field Value
DependencyProperty
IsCheckedProperty
Identifies the IsChecked dependency property.
Declaration
public static readonly DependencyProperty IsCheckedProperty
Field Value
DependencyProperty
IsCurrentProperty
Identifies the IsCurrent dependency property.
Declaration
public static readonly DependencyProperty IsCurrentProperty
Field Value
DependencyProperty
IsHighlightedProperty
Identifies the IsHighlighted dependency property.
Declaration
public static readonly DependencyProperty IsHighlightedProperty
Field Value
DependencyProperty
IsSeparatorProperty
Identifies the IsSeparatorProperty dependency property.
Declaration
public static readonly DependencyProperty IsSeparatorProperty
Field Value
DependencyProperty
IsSubmenuOpenProperty
Identifies the IsSubmenuOpen dependency property.
Declaration
public static readonly DependencyProperty IsSubmenuOpenProperty
Field Value
DependencyProperty
IsSuspendingPopupAnimationProperty
Identifies the IsSuspendingPopupAnimation readonly dependency property.
Declaration
public static readonly DependencyProperty IsSuspendingPopupAnimationProperty
Field Value
DependencyProperty
ItemContainerTemplateSelectorProperty
Identifies the ItemContainerTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty ItemContainerTemplateSelectorProperty
Field Value
DependencyProperty
ItemIconPositionProperty
Identifies the ItemIconPosition dependency property.
Declaration
public static readonly DependencyProperty ItemIconPositionProperty
Field Value
DependencyProperty
MenuProperty
Identifies the Menu readonly dependency property.
Declaration
public static readonly DependencyProperty MenuProperty
Field Value
DependencyProperty
RoleProperty
Identifies the Role dependency property.
Declaration
public static readonly DependencyProperty RoleProperty
Field Value
DependencyProperty
SeparatorTemplateKeyProperty
Identifies the SeparatorTemplateKey dependency property.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuSeparatorItem container and set its Template property.", false)]
public static readonly DependencyProperty SeparatorTemplateKeyProperty
Field Value
DependencyProperty
StaysOpenOnClickProperty
Identifies the StaysOpenOnClick dependency property.
Declaration
public static readonly DependencyProperty StaysOpenOnClickProperty
Field Value
DependencyProperty
SubmenuClosedEvent
Identifies the SubmenuClosed routed event.
Declaration
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly RoutedEvent SubmenuClosedEvent
Field Value
RoutedEvent
SubmenuHeaderTemplateKeyProperty
Identifies the SubmenuHeaderTemplateKey dependency property.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public static readonly DependencyProperty SubmenuHeaderTemplateKeyProperty
Field Value
DependencyProperty
SubmenuItemTemplateKeyProperty
Identifies the SubmenuItemTemplateKey dependency property.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public static readonly DependencyProperty SubmenuItemTemplateKeyProperty
Field Value
DependencyProperty
SubmenuOpenedEvent
Identifies the SubmenuOpened routed event.
Declaration
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly RoutedEvent SubmenuOpenedEvent
Field Value
RoutedEvent
TopLevelHeaderTemplateKeyProperty
Identifies the TopLevelHeaderTemplateKey dependency property.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public static readonly DependencyProperty TopLevelHeaderTemplateKeyProperty
Field Value
DependencyProperty
TopLevelItemTemplateKeyProperty
Identifies the TopLevelItemTemplateKey dependency property.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public static readonly DependencyProperty TopLevelItemTemplateKeyProperty
Field Value
DependencyProperty
UncheckedEvent
Identifies the Unchecked routed event.
Declaration
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly RoutedEvent UncheckedEvent
Field Value
RoutedEvent
Properties
CheckedIcon
Gets or sets the icon that appears in a RadMenuItem when it is checkable and is checked. This is a dependency property.
CheckedIconTemplate
Gets or sets the data template used for the CheckedIcon. This is a dependency property.
Declaration
public DataTemplate CheckedIconTemplate { get; set; }
Property Value
DataTemplate
Command
Gets the command that will be executed when the command source is invoked.
Declaration
[TypeConverter(typeof(CommandConverter))]
public ICommand Command { get; set; }
Property Value
CommandParameter
Represents a user defined data value that can be passed to the command when it is executed.
CommandTarget
The object that the command is being executed on.
Declaration
public IInputElement CommandTarget { get; set; }
Property Value
IInputElement
DropDownHeight
Gets or sets the height of the drop-down area.
DropDownPlacement
Gets or sets the placement of the drop-down area.
Declaration
public MenuPlacementMode DropDownPlacement { get; set; }
Property Value
DropDownWidth
Gets or sets the width of the drop-down area.
HandlesScrolling
Gets whether the control supports scrolling.
Icon
Gets or sets the icon that appears in a RadMenuItem. This is a dependency property.
Declaration
[SRCategory("Appearance")]
public object Icon { get; set; }
Property Value
IconColumnWidth
Gets or sets the width of the column that contains the icon.
IconTemplate
Gets or sets the data template used for Icon. This is a dependency property.
Declaration
public DataTemplate IconTemplate { get; set; }
Property Value
DataTemplate
InputGestureText
Gets or sets the text describing an input gesture that will call the command tied to the specified item.
Declaration
[Bindable(true)]
public string InputGestureText { get; set; }
Property Value
IsCheckable
Gets a value that indicates whether a RadMenuItem can be checked. This is a dependency property.
Declaration
[SRCategory("Behavior")]
public bool IsCheckable { get; set; }
Property Value
IsChecked
Gets or sets a value that indicates whether the RadMenuItem is checked. This is a dependency property.
Declaration
[SRCategory("Appearance")]
public bool IsChecked { get; set; }
Property Value
IsCurrent
Gets or sets whether the item is current item.
IsEnabledCore
True if the RadMenuItem can be selected; otherwise, false.
IsHighlighted
Gets a value that indicates whether a RadMenuItem is highlighted. This is a dependency property.
Declaration
[Browsable(false)]
[SRCategory("Appearance")]
public bool IsHighlighted { get; protected set; }
Property Value
IsSeparator
Gets or sets a value indicating whether this instance is a separator.
IsSubmenuOpen
Gets a value that indicates whether the submenu of the RadMenuItem is open. This is a dependency property.
Declaration
[Browsable(false)]
[SRCategory("Appearance")]
public bool IsSubmenuOpen { get; set; }
Property Value
IsSuspendingPopupAnimation
Gets whether a menu suspends animations on its Popup control.
ItemContainerTemplateSelector
Gets or sets the custom logic for choosing a template used to display each item.
Declaration
public DataTemplateSelector ItemContainerTemplateSelector { get; set; }
Property Value
DataTemplateSelector
ItemIconPosition
Gets or sets the icon position for the icon. This is a dependency property.
Declaration
public ItemIconPosition ItemIconPosition { get; set; }
Property Value
Menu
Gets the RadMenu for this RadMenuItem. This is a readonly dependency property.
Role
Gets a value that indicates the role of a RadMenuItem. This is a dependency property.
Declaration
[SRCategory("Behavior")]
public MenuItemRole Role { get; }
Property Value
SeparatorTemplateKey
Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a separator.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuSeparatorItem container and set its Template property.", false)]
public ControlTemplate SeparatorTemplateKey { get; set; }
Property Value
ControlTemplate
StaysOpenOnClick
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.
Declaration
[SRCategory("Behavior")]
public bool StaysOpenOnClick { get; set; }
Property Value
SubmenuHeaderTemplateKey
Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a header of a submenu.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public ControlTemplate SubmenuHeaderTemplateKey { get; set; }
Property Value
ControlTemplate
SubmenuItemTemplateKey
Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a submenu.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use Template property.", false)]
public ControlTemplate SubmenuItemTemplateKey { get; set; }
Property Value
ControlTemplate
TopLevelHeaderTemplateKey
Gets the resource key for a style applied to a RadMenuItem when the RadMenuItem is a header of a top-level menu.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public ControlTemplate TopLevelHeaderTemplateKey { get; set; }
Property Value
ControlTemplate
TopLevelItemTemplateKey
Gets the resource key for a style applied to a RadMenuItem when it is a top-level RadMenuItem.
Declaration
[Obsolete("Since 2013 Q1 this property is not needed. Please use RadMenuRootItem container and set its Template property.", false)]
public ControlTemplate TopLevelItemTemplateKey { get; set; }
Property Value
ControlTemplate
Methods
ChangeVisualState(bool)
Updates the visual state of the control.
Declaration
protected virtual void ChangeVisualState(bool useTransitions)
Parameters
useTransitions
Indicates whether transitions should be used.
ClearContainerForItemOverride(DependencyObject, object)
Clear the Menu property.
Declaration
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameters
element
DependencyObject
Element used to display the specified item.
item
Specified item.
GetContainerForItemOverride()
Creates or identifies the element that is used to display the given item.
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
DependencyObject
IsItemItsOwnContainerOverride(object)
Determines if the specified item is RadMenuItem.
Declaration
protected override sealed bool IsItemItsOwnContainerOverride(object item)
Parameters
item
The item to check.
Returns
True if the item is RadMenuItem; otherwise, false.
IsItemItsOwnContainerProtected(object)
Determines if the specified item is RadMenuItem.
Declaration
protected virtual bool IsItemItsOwnContainerProtected(object item)
Parameters
item
The item to check.
Returns
True if the item is RadMenuItem; otherwise, false.
OnAccessKey(AccessKeyEventArgs)
Provides class handling for when an access key that is meaningful for this element is invoked.
Declaration
protected override void OnAccessKey(AccessKeyEventArgs e)
Parameters
e
AccessKeyEventArgs
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.
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call .
Declaration
public override void OnApplyTemplate()
OnChecked(RoutedEventArgs)
Called when the IsChecked property becomes true.
Declaration
protected virtual void OnChecked(RoutedEventArgs e)
Parameters
e
RoutedEventArgs
The event data for the Checked event.
OnClick()
Called when a RadMenuItem is clicked and raises a Click event.
Declaration
protected virtual void OnClick()
OnCreateAutomationPeer()
Provides an appropriate RadMenuItemAutomationPeer implementation for this control, as part of the automation infrastructure.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
AutomationPeer
OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)
Invoked when an unhandled Keyboard.GotKeyboardFocus attached event reaches an element in its route that is derived from this class.
Declaration
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters
e
KeyboardFocusChangedEventArgs
The KeyboardFocusChangedEventArgs that contains the event data.
OnHeaderTemplateChanged(DataTemplate, DataTemplate)
Declaration
protected override void OnHeaderTemplateChanged(DataTemplate oldHeaderTemplate, DataTemplate newHeaderTemplate)
Parameters
oldHeaderTemplate
DataTemplate
newHeaderTemplate
DataTemplate
OnHeaderTemplateSelectorChanged(DataTemplateSelector, DataTemplateSelector)
Declaration
protected override void OnHeaderTemplateSelectorChanged(DataTemplateSelector oldHeaderTemplateSelector, DataTemplateSelector newHeaderTemplateSelector)
Parameters
oldHeaderTemplateSelector
DataTemplateSelector
newHeaderTemplateSelector
DataTemplateSelector
OnInitialized(EventArgs)
Raises the event. This method is invoked whenever is set to true internally.
Declaration
protected override void OnInitialized(EventArgs e)
Parameters
e
The RoutedEventArgs that contains the event data.
OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
Called when the focus is no longer on or within a RadMenuItem.
Declaration
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Parameters
e
DependencyPropertyChangedEventArgs
The event data for the event.
OnItemsChanged(NotifyCollectionChangedEventArgs)
Invoked when the property changes.
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
e
NotifyCollectionChangedEventArgs
Information about the change.
OnKeyDown(KeyEventArgs)
Raises the event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
e
KeyEventArgs
The KeyEventArgs instance containing the event data.
OnMouseEnter(MouseEventArgs)
Raises the event.
Declaration
protected override void OnMouseEnter(MouseEventArgs e)
Parameters
e
MouseEventArgs
The MouseEventArgs instance containing the event data.
OnMouseLeave(MouseEventArgs)
Raises the event.
Declaration
protected override void OnMouseLeave(MouseEventArgs e)
Parameters
e
MouseEventArgs
The MouseEventArgs instance containing the event data.
OnMouseLeftButtonDown(MouseButtonEventArgs)
Raises the event.
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
e
MouseButtonEventArgs
The MouseButtonEventArgs instance containing the event data.
OnMouseLeftButtonUp(MouseButtonEventArgs)
Raises the event.
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
e
MouseButtonEventArgs
The MouseButtonEventArgs instance containing the event data.
OnMouseMove(MouseEventArgs)
Raises the event.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
e
MouseEventArgs
The MouseEventArgs instance containing the event data.
OnMouseRightButtonDown(MouseButtonEventArgs)
Handles MouseRightButtonDown event.
Declaration
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
Parameters
e
MouseButtonEventArgs
The MouseButtonEventArgs that contains the event data. The event data reports that the right mouse button was pressed.
OnMouseRightButtonUp(MouseButtonEventArgs)
Handles MouseRightButtonUp event.
Declaration
protected override void OnMouseRightButtonUp(MouseButtonEventArgs e)
Parameters
e
MouseButtonEventArgs
The MouseButtonEventArgs that contains the event data. The event data reports that the right mouse button was released.
OnSubmenuClosed(RadRoutedEventArgs)
Called when the submenu of a RadMenuItem is closed.
Declaration
protected virtual void OnSubmenuClosed(RadRoutedEventArgs e)
Parameters
e
The event data for the SubmenuClosed event.
OnSubmenuOpened(RadRoutedEventArgs)
Called when the submenu of a RadMenuItem is opened.
Declaration
protected virtual void OnSubmenuOpened(RadRoutedEventArgs e)
Parameters
e
The event data for the SubmenuOpened event.
OnUnchecked(RoutedEventArgs)
Called when the IsChecked property becomes false.
Declaration
protected virtual void OnUnchecked(RoutedEventArgs e)
Parameters
e
RoutedEventArgs
The event data for the Unchecked event.
PrepareContainerForItemOverride(DependencyObject, object)
Prepares the specified element to display the specified item.
Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
element
DependencyObject
Element used to display the specified item.
item
Specified item.
Events
Checked
Occurs when a RadMenuItem is checked.
Declaration
[SRCategory("Behavior")]
public event RoutedEventHandler Checked
Event Value
RoutedEventHandler
Click
Occurs when a RadMenuItem is clicked.
Declaration
[SRCategory("Behavior")]
public event RadRoutedEventHandler Click
Event Value
SubmenuClosed
Occurs when the state of the IsSubmenuOpen property changes to false.
Declaration
[SRCategory("Behavior")]
public event RadRoutedEventHandler SubmenuClosed
Event Value
SubmenuOpened
Occurs when the state of the IsSubmenuOpen property changes to true.
Declaration
[SRCategory("Behavior")]
public event RadRoutedEventHandler SubmenuOpened
Event Value
Unchecked
Occurs when a RadMenuItem is unchecked.
Declaration
[SRCategory("Behavior")]
public event RoutedEventHandler Unchecked
Event Value
RoutedEventHandler