New to Telerik UI for WinForms? Start a free 30-day trial

Represents a RadCommandBar control - a flexible component for implementation of tool and button bars featuring docking behavior, toggling buttons, shrinkable toolbars. The RadCommandBar is responsible for managing RadCommandBarBaseItem which are positioned on some of the CommandBarStripElement ///

Only items that inherit the RadCommandBarBaseItem class can be placed inside the strip elements. You can use the special CommandBarHostItem to host any other RadElement.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
[TelerikToolboxCategory("Menus & Toolbars")]
[Docking(DockingBehavior.Ask)]
public class RadCommandBar : RadControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider

Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadCommandBar...

Derived Classes: RadPdfViewerNavigator

Implements: IAnalyticsProviderIBindableComponentIComponentIComponentTreeHandlerIDisposableIDropTargetILayoutHandlerINotifyPropertyChangedISupportInitializeISupportInitializeNotificationISynchronizeInvokeIWin32Window...

Inherited Members RadControl.isResizing2RadControl.isDisposing2RadControl.invalidResizeRectRadControl.isAccessibilityRequestedRadControl.Dispose(bool)RadControl.Construct()RadControl.CreateBehavior()RadControl.InitializeRootElement(RootRadElement)RadControl.LoadElementTree()RadControl.LoadElementTree(Size)RadControl.OnKeyDown(KeyEventArgs)RadControl.OnKeyUp(KeyEventArgs)RadControl.OnPreviewKeyDown(PreviewKeyDownEventArgs)RadControl.OnKeyPress(KeyPressEventArgs)RadControl.OnClick(EventArgs)RadControl.OnDoubleClick(EventArgs)RadControl.OnMouseUp(MouseEventArgs)RadControl.OnMouseEnter(EventArgs)RadControl.OnMouseLeave(EventArgs)RadControl.OnMouseMove(MouseEventArgs)RadControl.OnMouseHover(EventArgs)RadControl.OnMouseWheel(MouseEventArgs)RadControl.OnMouseCaptureChanged(EventArgs)RadControl.OnGotFocus(EventArgs)RadControl.OnLostFocus(EventArgs)RadControl.OnCreateControl()RadControl.OnHandleDestroyed(EventArgs)RadControl.OnVisibleChanged(EventArgs)RadControl.OnFontChanged(EventArgs)RadControl.OnForeColorChanged(EventArgs)RadControl.OnBackColorChanged(EventArgs)RadControl.OnEnabledChanged(EventArgs)RadControl.OnBindingContextChanged(EventArgs)RadControl.OnLocationChanged(EventArgs)RadControl.OnPaddingChanged(EventArgs)RadControl.OnRightToLeftChanged(EventArgs)RadControl.OnPaint(PaintEventArgs)RadControl.OnLayout(LayoutEventArgs)RadControl.OnAutoSizeChanged(EventArgs)RadControl.WndProc(ref Message)RadControl.OnInvalidated(RadElement)RadControl.OnCaptureLosing()RadControl.OnToolTipTextNeeded(object, ToolTipTextNeededEventArgs)RadControl.OnScreenTipNeeded(object, ScreenTipNeededEventArgs)RadControl.OnThemeNameChanged(ThemeNameChangedEventArgs)RadControl.ProcessMnemonic(char)RadControl.ProcessFocusRequested(RadElement)RadControl.ProcessCaptureChangeRequested(RadElement, bool)RadControl.IsInputKey(Keys)RadControl.GetInputElement()RadControl.BeginInit()RadControl.EndInit()RadControl.OnNotifyPropertyChanged(string)RadControl.OnNotifyPropertyChanged(PropertyChangedEventArgs)RadControl.SetBoundsCore(int, int, int, int, BoundsSpecified)RadControl.GetRootElementDesiredSize(int, int, int, int)RadControl.OnZoomGesture(ZoomGestureEventArgs)RadControl.OnRotateGesture(RotateGestureEventArgs)RadControl.OnPanGesture(PanGestureEventArgs)RadControl.OnTwoFingerTapGesture(GestureEventArgs)RadControl.OnPressAndTapGesture(PressAndTapGestureEventArgs)RadControl.OnGesture(GestureEventArgs)RadControl.ProcessGesture(Message)RadControl.EnableGesture(GestureType)RadControl.DisableGesture(GestureType)RadControl.Refresh()RadControl.SuspendUpdate()RadControl.ResumeUpdate()RadControl.ResumeUpdate(bool)RadControl.InvokeLayoutCallback(LayoutCallback)RadControl.RegisterHostedControl(RadHostItem)RadControl.UnregisterHostedControl(RadHostItem, bool)RadControl.ResolveStyleGroupForElement(StyleGroup, RadObject)RadControl.GetPlainText()RadControl.ShouldSerializeProperty(RadProperty)RadControl.ShouldSerializeProperty(RadProperty, RadObject)RadControl.ResetProperty(RadProperty, RadObject)RadControl.CanEditElementAtDesignTime(RadElement)RadControl.FindPropertyInChildren(RadControl, IPCMessage)RadControl.ScaleControl(SizeF, BoundsSpecified)RadControl.PerformRadAutoScale(BoundsSpecified?)RadControl.GetMonitorDpiScaleFactor(Control)RadControl.SetRadAutoScale(bool)RadControl.EnableDpiScalingRadControl.EnableRadAutoScaleRadControl.EnableRadFormInitialDpiScalingRadControl.EnableImageDpiScalingRadControl.EnableSvgImagesRadControl.IsLoadedRadControl.ElementTreeRadControl.UseCompatibleTextRenderingDefaultValueRadControl.BehaviorRadControl.RootElementRadControl.PaddingRadControl.ThemeNameRadControl.TextRadControl.EnableThemingRadControl.ThemeClassNameRadControl.ImageListRadControl.ImageScalingSizeRadControl.UseCompatibleTextRenderingRadControl.MaximumSizeRadControl.MinimumSizeRadControl.FocusableRadControl.SiteRadControl.CausesValidationRadControl.IsInitializingRadControl.SmallImageListRadControl.SmallImageScalingSizeRadControl.IsDesignModeRadControl.IsDisplayedRadControl.FocusedElementRadControl.AllowShowFocusCuesRadControl.ShowItemToolTipsRadControl.CommandBindingsRadControl.EnableKeyMapRadControl.ForeColorRadControl.FontRadControl.ValidationCancelRadControl.EnableAnalyticsRadControl.AnalyticsNameRadControl.EnableRadAccessibilityObjectsRadControl.EnableCodedUITestsRadControl.EnableCodedUITestsDefaultValueRadControl.EnableUIAutomationRadControl.EnableUIAutomationDefaultValueRadControl.ElementInvalidatedRadControl.ToolTipTextNeededRadControl.ScreenTipNeededRadControl.ThemeNameChangedRadControl.InitializedRadControl.PropertyChangedRadControl.ZoomGestureRadControl.RotateGestureRadControl.PanGestureRadControl.TwoFingerTapGestureRadControl.PressAndTapGesture...

Constructors

Initializes a new instance of the RadCommandBar class.

C#
public RadCommandBar()

Fields

The key for the OrientationChanged event.

C#
public static readonly object OrientationChangedEventKey

The key for the OrientationChanging event.

C#
public static readonly object OrientationChangingEventKey

Properties

Gets or sets a value indicating whether the control automatically resizes to fit its contents.

C#
public override bool AutoSize { get; set; }
Property Value:

true if the control automatically resizes to fit its contents; otherwise, false.

Overrides: RadControl.AutoSize

RadCommandBar consists of multiple visual elements and separate settings are provided to customize their appearance. Current BackColor property might be ignored.

C#
public override Color BackColor { get; set; }

Overrides: RadControl.BackColor

Gets or sets the RadCommandBarElement of the RadCommandBar control.

C#
[Browsable(false)]
public RadCommandBarElement CommandBarElement { get; set; }

Gets the RadDropDownMenu opened by right-clicking an empty row area or the control itself.

C#
public RadDropDownMenu CustomizeContextMenu { get; }

Gets the default 25-by-25 control size used before an explicit size is specified.

C#
protected override Size DefaultSize { get; }

Overrides: Control.DefaultSize

Gets or sets which RadCommandBar borders are docked to its parent control and determines how a control is resized with its parent.

C#
public override DockStyle Dock { get; set; }
Property Value:

One of the DockStyle values. The default is None.

Exceptions: InvalidEnumArgumentException

The value assigned is not one of the DockStyle values.

Overrides: Control.Dock

Gets or sets the size in pixels when current strip is being Drag and Drop in next or previous row.

C#
public Size DragSize { get; set; }

Gets or sets the orientation of the commandbar - could be horizontal or vertical. This property is controlled by the Dock property of the RadCommandBar control.

C#
[Browsable(false)]
public Orientation Orientation { get; set; }

Gets the rows of the commandbar.

C#
[RadNewItem("", false, true, true)]
[RadEditItemsAction]
[Browsable(true)]
public RadCommandBarLinesElementCollection Rows { get; }

Methods

Indicates whether the command bar supplies theme settings for the specified element types.

C#
public override bool ControlDefinesThemeForElement(RadElement element)
Parameters:elementRadElement

The element whose theme ownership is being checked.

Returns:

bool

true for the text, drop-down, and arrow elements managed by the command bar; otherwise, false.

Overrides: RadControl.ControlDefinesThemeForElement(RadElement)

Creates an accessibility instance for the command bar control.

C#
protected override AccessibleObject CreateAccessibilityInstance()
Returns:

AccessibleObject

A RadCommandBarAccessibleObject if accessibility is enabled; otherwise, the base accessibility object.

Overrides: Control.CreateAccessibilityInstance()

Creates and initializes the child items of the command bar, including the main command bar element and context menu.

C#
protected override void CreateChildItems(RadElement parent)
Parameters:parentRadElement

The parent RadElement to which child elements will be added.

Overrides: RadControl.CreateChildItems(RadElement)

Creates the command bar element for the RadCommandBar.

C#
protected virtual RadCommandBarElement CreateCommandBarElement()
Returns:

RadCommandBarElement

A new instance of RadCommandBarElement.

Creates the root element for the RadCommandBar.

C#
protected override RootRadElement CreateRootElement()
Returns:

RootRadElement

A new instance of RadCommandBar.RadCommandBarRootElement.

Overrides: RadControl.CreateRootElement()

Calculates the preferred size, using the current size when an auto-sized parent supplies a zero dimension.

C#
public override Size GetPreferredSize(Size proposedSize)
Parameters:proposedSizeSize

The size proposed by the parent layout.

Returns:

Size

The preferred size calculated by the base control.

Overrides: RadControl.GetPreferredSize(Size)

Enables panning gestures after the control is loaded.

C#
protected override void OnLoad(Size desiredSize)
Parameters:desiredSizeSize

The size requested for the control during loading.

Overrides: RadControl.OnLoad(Size)

Opens the strip visibility and customization context menu on a right-click over the control or a row.

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

The mouse position and button state.

Overrides: RadControl.OnMouseDown(MouseEventArgs)

Raises the event.

C#
protected virtual void OnOrientationChanged(EventArgs args)
Parameters:argsEventArgs

A EventArgs that contains the event data.

Raises the event.

C#
protected virtual bool OnOrientationChanging(CancelEventArgs args)
Parameters:argsCancelEventArgs

A CancelEventArgs that contains the event data.

Returns:

bool

True if the change of orientation should be canceled, false otherwise.

Tracks the containing form so floating strips can be hidden when the form is minimized.

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

The event data.

Overrides: RadControl.OnParentChanged(EventArgs)

Refreshes the theme name applied to strip overflow-button hosts.

C#
protected override void OnThemeChanged()

Overrides: RadControl.OnThemeChanged()

Leaves root stretch settings unchanged when AutoSize changes; the command-bar orientation manages those settings.

C#
protected override void ProcessAutoSizeChanged(bool value)
Parameters:valuebool

The new AutoSize value.

Overrides: RadControl.ProcessAutoSizeChanged(bool)

Returns the row count for the coded-UI Lines property request and delegates other requests to the base control.

C#
protected override void ProcessCodedUIMessage(ref IPCMessage request)
Parameters:requestIPCMessage

The coded-UI message to process.

Overrides: RadControl.ProcessCodedUIMessage(ref IPCMessage)

Removes the back-color overrides from the command bar and its rows, and resets the gradient override on the command bar element.

C#
protected override void ResetBackColorThemeOverrides()

Overrides: RadControl.ResetBackColorThemeOverrides()

Removes the foreground-color override and reapplies the theme to the element tree.

C#
protected override void ResetForeColorThemeOverrides()

Overrides: RadControl.ResetForeColorThemeOverrides()

Applies the control's back color to the command bar and its rows, and a solid-gradient override to the command bar element.

C#
protected override void SetBackColorThemeOverrides()

Overrides: RadControl.SetBackColorThemeOverrides()

Applies the control's foreground color as a theme override on the command bar element.

C#
protected override void SetForeColorThemeOverrides()

Overrides: RadControl.SetForeColorThemeOverrides()

Applies the orientation to the control and its child elements.

C#
protected virtual void SetOrientationCore(Orientation value, bool fireEvents)
Parameters:valueOrientation

The orientation to apply

fireEventsbool

Indicates whether events should be fired

Propagates the control's theme name to each strip's overflow-button host.

C#
protected virtual void SetThemeCore()

Events

Occurs when a floating strip is created.

C#
public event EventHandler FloatingStripCreated

Occurs before a floating form is created.

C#
public event CancelEventHandler FloatingStripCreating

Occurs when a floating strip is docked.

C#
public event EventHandler FloatingStripDocked

Occurs before a floating strip is docked.

C#
public event CancelEventHandler FloatingStripDocking

Occurs after the orientation is changed.

C#
public event EventHandler OrientationChanged

Occurs before the orientation is changed.

C#
public event CancelEventHandler OrientationChanging