Class RadMenu
Represents a menu. RadMenu can be horizontal or vertical. You can add, remove, and disable menu items at run-time. It offers full theming support, allowing you to easily construct a variety of stunning visual effects. You can nest any other RadControl within a RadMenu. For example, you can create a menu with an embedded textbox or combobox.
RadMenu is a simple wrapper for the RadMenuElement class.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
[TelerikToolboxCategory("Menus & Toolbars")]
public class RadMenu : RadItemsControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider, IItemsControl, IMessageListener
Constructors
RadMenu()
Initializes a new instance of the RadMenu class. RadMenu can be horizontal or vertical. You can add, remove, and disable menu items at run-time. It offers full theming support, allowing you to easily construct a variety of stunning visual effects. You can nest any other RadControl within a RadMenu. For example, you can create a menu with an embedded textbox or combobox.
Declaration
public RadMenu()
Properties
AllItemsEqualHeight
Gets or sets a value indicating whether all menu items will appear with the same height, using the height of the tallest item in the collection.
Declaration
[RadDescription("AllItemsEqualHeight", typeof(RadMenuElement))]
[RadDefaultValue("AllItemsEqualHeight", typeof(RadMenuElement))]
public bool AllItemsEqualHeight { get; set; }
Property Value
System.Boolean
|
AllowMerge
Gets or sets a value indicating whether this menu allows merging with other RadMenu instances to create a unified menu structure.
Declaration
public bool AllowMerge { get; set; }
Property Value
System.Boolean
|
AutoSize
Gets or sets a value indicating whether the menu automatically adjusts its size to fit its content.
Declaration
public override bool AutoSize { get; set; }
Property Value
System.Boolean
|
Overrides
BackColor
Gets or sets the background color of the menu. Note that RadMenu consists of multiple visual elements and separate settings are provided to customize their appearance, so this property might be ignored.
Declaration
public override Color BackColor { get; set; }
Property Value
System.Drawing.Color
|
Overrides
DefaultSize
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
|
Dock
Gets or sets which edge of the parent container the menu is docked to.
Declaration
public override DockStyle Dock { get; set; }
Property Value
System.Windows.Forms.DockStyle
|
DropDownAnimationEasing
Gets or sets the easing type used for dropdown animations when DropDownAnimationEnabled is true.
Declaration
[RadDefaultValue("DropDownAnimationEasing", typeof(RadMenuElement))]
public RadEasingType DropDownAnimationEasing { get; set; }
Property Value
RadEasingType
|
DropDownAnimationEnabled
Gets or sets a value indicating whether dropdown animations are enabled when submenu items are displayed.
Declaration
[RadDefaultValue("DropDownAnimationEnabled", typeof(RadMenuElement))]
public bool DropDownAnimationEnabled { get; set; }
Property Value
System.Boolean
|
DropDownAnimationFrames
Gets or sets the number of frames used for dropdown animations when DropDownAnimationEnabled is true.
Declaration
[RadDefaultValue("DropDownAnimationFrames", typeof(RadMenuElement))]
public int DropDownAnimationFrames { get; set; }
Property Value
System.Int32
|
ForeColor
This property is not relevant for this class.
Declaration
public override Color ForeColor { get; set; }
Property Value
System.Drawing.Color
|
Overrides
IsMainMenu
Gets or sets a value indicating whether this RadMenu handles MDI (Multiple Document Interface) menu functionality and system buttons for child forms.
Declaration
public bool IsMainMenu { get; set; }
Property Value
System.Boolean
|
Items
Gets the collection of root menu items that are displayed in the menu. Root items are top-level menu items that have no parent item and can contain child items as submenus.
Declaration
[RadEditItemsAction]
[RadNewItem("Type here", true, true, false)]
public override RadItemOwnerCollection Items { get; }
Property Value
RadItemOwnerCollection
|
Overrides
MenuElement
Gets the instance of RadMenuElement wrapped by this control. RadMenuElement is the main element in the hierarchy tree and encapsulates the actual functionality of RadMenu.
Declaration
public RadMenuElement MenuElement { get; }
Property Value
RadMenuElement
|
Orientation
Gets or sets the System.Windows.Forms.Orientation of menu items, determining whether they are arranged horizontally or vertically.
Declaration
[RadDescription("Orientation", typeof(RadMenuElement))]
[RadDefaultValue("Orientation", typeof(RadMenuElement))]
public Orientation Orientation { get; set; }
Property Value
System.Windows.Forms.Orientation
|
StretchItems
Gets or sets a value indicating whether menu items should be stretched to fill the available space in the menu.
Declaration
public bool StretchItems { get; set; }
Property Value
System.Boolean
|
SystemKeyHighlight
Gets or sets a value indicating whether the Alt or F10 keys can be used to highlight and activate the menu for keyboard navigation.
Declaration
public bool SystemKeyHighlight { get; set; }
Property Value
System.Boolean
|
Text
This property is not relevant for this class.
Declaration
public override string Text { get; set; }
Property Value
System.String
|
Overrides
Methods
CallBaseProcessDialogKey(Keys)
Declaration
protected override bool CallBaseProcessDialogKey(Keys keyData)
Parameters
System.Windows.Forms.Keys
keyData
|
Returns
System.Boolean
|
Overrides
CanProcessItem(RadMenuItemBase)
Declaration
protected virtual bool CanProcessItem(RadMenuItemBase menuItem)
Parameters
RadMenuItemBase
menuItem
|
Returns
System.Boolean
|
CanProcessMnemonic(Char)
Determines whether the specified character can be processed as a mnemonic for any menu item.
Declaration
public override bool CanProcessMnemonic(char keyData)
Parameters
System.Char
keyData
The character to test for mnemonic processing. |
Returns
System.Boolean
true if the character can be processed as a mnemonic; otherwise, false. |
Overrides
CreateAccessibilityInstance()
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
System.Windows.Forms.AccessibleObject
|
CreateChildItems(RadElement)
Creates and initializes the child elements of the menu, including the RadMenuElement and its event handlers.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
RadElement
parent
The parent element to add child elements to. |
Overrides
CreateRootElement()
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
System.Boolean
disposing
|
Overrides
GetCurrentProcessedItem(IItemsControl)
Declaration
protected virtual RadMenuItemBase GetCurrentProcessedItem(IItemsControl itemsControl)
Parameters
IItemsControl
itemsControl
|
Returns
RadMenuItemBase
|
GetSysCharItem(IItemsControl, Char)
Declaration
protected virtual RadMenuItemBase GetSysCharItem(IItemsControl itemsControl, char searchKey)
Parameters
IItemsControl
itemsControl
|
System.Char
searchKey
|
Returns
RadMenuItemBase
|
InitializeRootElement(RootRadElement)
Initializes the root element with default property values for the menu.
Declaration
protected override void InitializeRootElement(RootRadElement rootElement)
Parameters
RootRadElement
rootElement
The root element to initialize. |
Overrides
MergeMenu(RadMenu)
Merges the specified RadMenu with this menu, combining their menu items according to merge settings.
Declaration
public virtual void MergeMenu(RadMenu sourceMenu)
Parameters
RadMenu
sourceMenu
The source RadMenu to merge into this menu. |
Exceptions
System.ArgumentException
Thrown when attempting to merge a menu with itself. |
OnAllItemsEqualHeightChanged(EventArgs)
Raises the AllItemsEqualHeightChanged event when the equal height setting for menu items changes.
Declaration
protected virtual void OnAllItemsEqualHeightChanged(EventArgs args)
Parameters
System.EventArgs
args
An System.EventArgs that contains the event data. |
OnHandleCreated(EventArgs)
Called when the control handle is created. Sets up MDI functionality and system button handling if the parent form is an MDI container.
Declaration
protected override void OnHandleCreated(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
OnHandleDestroyed(EventArgs)
Declaration
protected override void OnHandleDestroyed(EventArgs e)
Parameters
System.EventArgs
e
|
Overrides
OnItemDeselected(ItemSelectedEventArgs)
Declaration
protected override void OnItemDeselected(ItemSelectedEventArgs args)
Parameters
ItemSelectedEventArgs
args
|
Overrides
OnItemSelected(ItemSelectedEventArgs)
Declaration
protected override void OnItemSelected(ItemSelectedEventArgs args)
Parameters
ItemSelectedEventArgs
args
|
Overrides
OnLeave(EventArgs)
Declaration
protected override void OnLeave(EventArgs e)
Parameters
System.EventArgs
e
|
OnLoad(Size)
Declaration
protected override void OnLoad(Size desiredSize)
Parameters
System.Drawing.Size
desiredSize
|
Overrides
OnMenuStateChanged(RadMenu.RadMenuState, RadMenu.RadMenuState)
Called when the menu state changes, handling the transition between different RadMenu.RadMenuState values.
Declaration
protected virtual void OnMenuStateChanged(RadMenu.RadMenuState oldState, RadMenu.RadMenuState newState)
Parameters
RadMenu.RadMenuState
oldState
The previous RadMenu.RadMenuState. |
RadMenu.RadMenuState
newState
The new RadMenu.RadMenuState. |
OnMouseDown(MouseEventArgs)
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
|
Overrides
OnMouseMove(MouseEventArgs)
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
|
Overrides
OnOrientationChanged(EventArgs)
Raises the OrientationChanged event when the menu orientation changes.
Declaration
protected virtual void OnOrientationChanged(EventArgs args)
Parameters
System.EventArgs
args
An System.EventArgs that contains the event data. |
OnTextOrientationChanged(EventArgs)
Raises the TextOrientationChanged event when the text orientation property value changes.
Declaration
protected virtual void OnTextOrientationChanged(EventArgs args)
Parameters
System.EventArgs
args
An System.EventArgs that contains the event data. |
PerformMouseDown(RadMenuItemBase)
Declaration
protected virtual void PerformMouseDown(RadMenuItemBase menuItem)
Parameters
RadMenuItemBase
menuItem
|
PreprocessMouseEvent(ref Message)
Declaration
protected virtual void PreprocessMouseEvent(ref Message msg)
Parameters
System.Windows.Forms.Message
msg
|
ProcessArrowKey(Keys)
Declaration
protected override bool ProcessArrowKey(Keys keyCode)
Parameters
System.Windows.Forms.Keys
keyCode
|
Returns
System.Boolean
|
Overrides
ProcessAutoSizeChanged(Boolean)
Declaration
protected override void ProcessAutoSizeChanged(bool value)
Parameters
System.Boolean
value
|
Overrides
ProcessCmdKey(ref Message, Keys)
Declaration
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
Parameters
System.Windows.Forms.Message
m
|
System.Windows.Forms.Keys
keyData
|
Returns
System.Boolean
|
Overrides
ProcessCodedUIMessage(ref IPCMessage)
Declaration
protected override void ProcessCodedUIMessage(ref IPCMessage request)
Parameters
IPCMessage
request
|
Overrides
ProcessDialogKey(Keys)
Declaration
protected override bool ProcessDialogKey(Keys keyData)
Parameters
System.Windows.Forms.Keys
keyData
|
Returns
System.Boolean
|
Overrides
ProcessFirstStageMnemonicActivation(ref Message, Keys)
Declaration
protected virtual bool ProcessFirstStageMnemonicActivation(ref Message m, Keys keyData)
Parameters
System.Windows.Forms.Message
m
|
System.Windows.Forms.Keys
keyData
|
Returns
System.Boolean
|
ProcessFocusRequested(RadElement)
Declaration
protected override bool ProcessFocusRequested(RadElement element)
Parameters
RadElement
element
|
Returns
System.Boolean
|
Overrides
ProcessLeftRightArrowKey(Boolean)
Declaration
protected override bool ProcessLeftRightArrowKey(bool right)
Parameters
System.Boolean
right
|
Returns
System.Boolean
|
Overrides
ProcessMnemonic(Char)
Declaration
protected override bool ProcessMnemonic(char charCode)
Parameters
System.Char
charCode
|
Returns
System.Boolean
|
Overrides
ProcessSecondStageMnemonicActivation(ref Message, Keys)
Declaration
protected virtual bool ProcessSecondStageMnemonicActivation(ref Message m, Keys keyData)
Parameters
System.Windows.Forms.Message
m
|
System.Windows.Forms.Keys
keyData
|
Returns
System.Boolean
|
ProcessUpDownArrowKey(Boolean)
Declaration
protected override bool ProcessUpDownArrowKey(bool down)
Parameters
System.Boolean
down
|
Returns
System.Boolean
|
Overrides
ResetBackColorThemeOverrides()
Declaration
protected override void ResetBackColorThemeOverrides()
Overrides
SetBackColorThemeOverrides()
Declaration
protected override void SetBackColorThemeOverrides()
Overrides
SetMenuState(RadMenu.RadMenuState)
Sets the current state of the menu for mnemonic and keyboard processing.
Declaration
public void SetMenuState(RadMenu.RadMenuState state)
Parameters
RadMenu.RadMenuState
state
The RadMenu.RadMenuState to set for the menu. |
UnmergeMenu(RadMenu)
Removes the merge relationship with the specified RadMenu, restoring the original menu structure.
Declaration
public void UnmergeMenu(RadMenu src)
Parameters
RadMenu
src
The source RadMenu to unmerge from this menu. |
Events
AllItemsEqualHeightChanged
Occurs when the AllItemsEqualHeight property value changes, indicating a change in the height uniformity setting for menu items.
Declaration
[RadDescription("AllItemsEqualHeightChanged", typeof(RadMenuElement))]
public event EventHandler AllItemsEqualHeightChanged
Event Type
System.EventHandler
|
OrientationChanged
Occurs when the Orientation property value changes, indicating a change in the layout direction of menu items.
Declaration
[RadDescription("OrientationChanged", typeof(RadMenuElement))]
public event EventHandler OrientationChanged
Event Type
System.EventHandler
|
TextOrientationChanged
Occurs when the text orientation property value changes, affecting how text is displayed within menu items.
Declaration
public event EventHandler TextOrientationChanged
Event Type
System.EventHandler
|
Explicit Interface Implementations
IMessageListener.DesiredHook
IMessageListener.PreviewMessage(ref Message)
Declaration
MessagePreviewResult IMessageListener.PreviewMessage(ref Message msg)
Parameters
System.Windows.Forms.Message
msg
|
Returns
MessagePreviewResult
|
Implements
IMessageListener.PreviewSystemMessage(SystemMessage, Message)
Declaration
void IMessageListener.PreviewSystemMessage(SystemMessage message, Message msg)
Parameters
SystemMessage
message
|
System.Windows.Forms.Message
msg
|
Implements
IMessageListener.PreviewWndProc(Message)
Declaration
void IMessageListener.PreviewWndProc(Message msg)
Parameters
System.Windows.Forms.Message
msg
|