Class RadMenuElement
Represents a menu. It may be nested in other telerik controls. RadMenu can be horizontal or vertical. You can add, remove, and disable menu items at run-time. It offers full support for the Telerik RadControls for WinForm theming engine, 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.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadMenuElement : RadItem, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode
Constructors
RadMenuElement()
Declaration
public RadMenuElement()
Fields
AllItemsEqualHeightProperty
Identifies the AllItemsEqualHeight dependency property that controls whether all menu items have the same height.
Declaration
public static RadProperty AllItemsEqualHeightProperty
Field Value
RadProperty
|
DropDownAnimationEasingProperty
Identifies the DropDownAnimationEasing dependency property that controls the easing type for dropdown animations.
Declaration
public static RadProperty DropDownAnimationEasingProperty
Field Value
RadProperty
|
DropDownAnimationEnabledProperty
Identifies the DropDownAnimationEnabled dependency property that controls whether dropdown animations are enabled.
Declaration
public static RadProperty DropDownAnimationEnabledProperty
Field Value
RadProperty
|
DropDownAnimationFramesProperty
Identifies the DropDownAnimationFrames dependency property that controls the number of animation frames.
Declaration
public static RadProperty DropDownAnimationFramesProperty
Field Value
RadProperty
|
OrientationProperty
Identifies the Orientation dependency property that determines the layout direction of menu items.
Declaration
public static RadProperty OrientationProperty
Field Value
RadProperty
|
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
[RadPropertyDefaultValue("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 RadMenuElement instances to create a unified menu structure.
Declaration
public bool AllowMerge { get; set; }
Property Value
System.Boolean
|
CloseButton
Gets or sets the close button element that provides functionality to close the parent form when the menu is used as a title bar.
Declaration
public RadImageButtonElement CloseButton { get; set; }
Property Value
RadImageButtonElement
|
ContextItem
Gets or sets the context menu item that represents the currently active context for contextual menu operations.
Declaration
public RadMenuItemBase ContextItem { get; set; }
Property Value
RadMenuItemBase
|
DropDownAnimationEasing
Gets or sets the easing type used for dropdown animations when DropDownAnimationEnabled is true.
Declaration
[RadPropertyDefaultValue("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
[RadPropertyDefaultValue("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
[RadPropertyDefaultValue("DropDownAnimationFrames", typeof(RadMenuElement))]
public int DropDownAnimationFrames { get; set; }
Property Value
System.Int32
|
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
[RadNewItem("Type here", true)]
public RadItemOwnerCollection Items { get; }
Property Value
RadItemOwnerCollection
|
Remarks
Menu items are hierarchical - they have a parent item and a list of children items. Children items are menu items that can be dropped down as submenu of their parent. The difference between the root and the non-root menu items is that root items have no parent item (the property IsRootItem can be used to check if an item is a root one). Note that Items contains all root menu items, not just the items that are displayed. An item remains in the Items collection even if it is an overflow item and is therefore not currently visible.
ItemsLayout
Gets an instance of the WrapLayoutPanel class that represents the layout panel responsible for arranging menu items within the menu.
Declaration
public WrapLayoutPanel ItemsLayout { get; }
Property Value
WrapLayoutPanel
|
MaximizeButton
Gets or sets the maximize button element that provides functionality to maximize or restore the parent form when the menu is used as a title bar.
Declaration
public RadImageButtonElement MaximizeButton { get; set; }
Property Value
RadImageButtonElement
|
MenuBorder
Gets an instance of the BorderPrimitive class that represents the border element of the menu.
Declaration
public BorderPrimitive MenuBorder { get; }
Property Value
BorderPrimitive
|
MenuFill
Gets an instance of the FillPrimitive class that represents the background fill element of the menu.
Declaration
public FillPrimitive MenuFill { get; }
Property Value
FillPrimitive
|
MinimizeButton
Gets or sets the minimize button element that provides functionality to minimize the parent form when the menu is used as a title bar.
Declaration
public RadImageButtonElement MinimizeButton { get; set; }
Property Value
RadImageButtonElement
|
Orientation
Gets or sets the System.Windows.Forms.Orientation of menu items, determining whether they are arranged horizontally or vertically.
Declaration
[RadPropertyDefaultValue("Orientation", typeof(RadMenuElement))]
public Orientation Orientation { get; set; }
Property Value
System.Windows.Forms.Orientation
|
SystemButtons
Gets or sets the StackLayoutPanel that contains the system buttons (minimize, maximize, and close) used when the menu functions as a title bar.
Declaration
public StackLayoutPanel SystemButtons { get; set; }
Property Value
StackLayoutPanel
|
Methods
ArrangeOverride(SizeF)
Arranges the child elements within the specified bounds, including proper positioning of system buttons.
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
System.Drawing.SizeF
finalSize
The final area within which the element should arrange itself and its children. |
Returns
System.Drawing.SizeF
The actual size used by the element. |
Overrides
CreateChildElements()
Creates and initializes the child elements of the menu, including the layout panel, system buttons, fill, and border primitives.
Declaration
protected override void CreateChildElements()
Overrides
InitializeFields()
Initializes the fields and collections used by the menu element, setting up the items collection and its properties.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Measures the size required by the menu element, including padding considerations.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
The available size that the parent element can allocate to this element. |
Returns
System.Drawing.SizeF
The size that this element determines it needs during layout. |
Overrides
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. |
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. |
OnPropertyChanged(RadPropertyChangedEventArgs)
Called when a property value changes. Handles orientation and equal height property changes to update the menu layout accordingly.
Declaration
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters
RadPropertyChangedEventArgs
e
A RadPropertyChangedEventArgs that contains the event data. |
Overrides
OnTunnelEvent(RadElement, RoutedEventArgs)
Handles tunnel events from child elements, particularly auto-size change events for proper layout management.
Declaration
protected override void OnTunnelEvent(RadElement sender, RoutedEventArgs args)
Parameters
RadElement
sender
The element that sent the event. |
RoutedEventArgs
args
A RoutedEventArgs that contains the event data. |
Overrides
Events
AllItemsEqualHeightChanged
Occurs when the AllItemsEqualHeight property value changes, indicating a change in the height uniformity setting for menu items.
Declaration
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
public event EventHandler OrientationChanged
Event Type
System.EventHandler
|