menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class XPToolBar - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class XPToolBar

    The XPToolBar class provides you a tool bar like look-and-feel that you can use outside the XPMenus framework to display BarItems.

    Inheritance
    System.Object
    BaseControl
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal
    XPToolBar
    Implements
    IThemeProvider
    System.IDisposable
    IBarControl
    IThemedControl
    ICallWndProcListener
    IBarHost
    IDesignable
    IIgnoreWorkingArea
    IVisualStyle
    Inherited Members
    BaseControl.CanApplyTheme
    BaseControl.CanOverrideStyle
    BaseControl.ControlName
    BaseControl.GetActiveThemeName()
    BaseControl.IsVisualStyleEnabled
    BaseControl.IThemeProvider.BaseThemeName
    BaseControl.RaiseThemeChanged(Object, ThemeChangedEventArgs)
    BaseControl.ThemeName
    BaseControl.ThemeNameChanged
    Namespace: Syncfusion.Windows.Forms.Tools.XPMenus
    Assembly: Syncfusion.Tools.Windows.dll
    Syntax
    public class XPToolBar : BarControlInternal, IThemeProvider, IDisposable, IBarControl, IThemedControl, IBarItemContainerControl, ICallWndProcListener, IBarHost, IDesignable, IIgnoreWorkingArea, IVisualStyle
    Remarks

    The XP tool bar look-and-feel is becoming so popular that they are beginning to get used outside of the form's menu structure, inside the forms. A good example is the PropertyGrid control that uses this look and feel to provide users some command buttons at the top (the Categorized/Alphabetic button, etc.).

    This XPToolBar makes it easy for you to get this tool bar look-and-feel outside the BarManager framework. Drop this control anywhere in your form and fill the items list with BarItems. You can also insert separators using the BeginGroupAt method.

    Examples
    In code, you can initialize an XPToolBar as follows:
    XPToolBar xpToolBar1;
    // Create a new tool bar control.
    
    XPToolBar xptoolbar2 = new XPToolBar();
    // Add some one or more instances of BarItem to it.
    xptoolbar2.Items.AddRange(new BarItem[]{this.barItem1, this.barItem2, this.barItem3});
    // Setup a separator.
    xptoolbar2.BeginGroupAt(this.barItem2);
    
    // Set its position and add it to the Form.
    xptoolbar2.Dock = DockStyle.Top;
    xptoolbar2.Size = new Size(200, 30);
    this.Controls.Add(xptoolbar2);
    Dim xpToolBar1 As XPToolBar
    ' Create a new tool bar control.
    Dim xptoolbar2 As New XPToolBar()
    
    ' Add some one or more instances of BarItem to it.
    xptoolbar2.Items.AddRange(New BarItem() {Me.barItem1, Me.barItem2, Me.barItem3})
    ' Setup a separator.
    xptoolbar2.BeginGroupAt(Me.barItem2)
    
    ' Set its position and add it to the Form.
    xptoolbar2.Dock = DockStyle.Top
    xptoolbar2.Size = New Size(200, 30)
    Me.Controls.Add(xptoolbar2)

    Constructors

    XPToolBar()

    Initializes a new instance of the XPToolBar class.

    Declaration
    public XPToolBar()

    Properties

    BackgroundColor

    Gets / sets the background color, gradient and other styles of the toolbar.

    Declaration
    public BrushInfo BackgroundColor { get; set; }
    Property Value
    Type
    BrushInfo
    Remarks

    The TreeViewAdv provides this property to enable specialized custom gradient backgrounds. This property is used only when XP Themes is disabled through the property or when themes are inactive in the OS.

    Bar

    Declaration
    public override Bar Bar { get; set; }
    Property Value
    Type
    Bar
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.Bar

    BarItemActiveFormCheckOverride

    Indicates whether the BarItems should check for ActiveForm before displaying tooltip. Workaround for using from MFC applications.

    Declaration
    public bool BarItemActiveFormCheckOverride { get; set; }
    Property Value
    Type
    System.Boolean

    DefaultSize

    Declaration
    protected override Size DefaultSize { get; }
    Property Value
    Type
    System.Drawing.Size

    EnableTouchMode

    Gets or sets value to enable or disable the Touchmode to the controls.

    Declaration
    public bool EnableTouchMode { get; set; }
    Property Value
    Type
    System.Boolean
    Remarks

    Scale factor will be updated automatically if scalefactor is equal to 1

    HiddenBarItems

    Read only. Gets the invisible BarItems that are hidden in the popup when the ShowChevron is set to true.

    Declaration
    public BarItems HiddenBarItems { get; }
    Property Value
    Type Description
    BarItems

    Array or BarItems.

    Remarks

    Should be used when ShowChevron is set to true

    HostedForm

    Declaration
    protected override Form HostedForm { get; set; }
    Property Value
    Type
    System.Windows.Forms.Form
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.HostedForm

    IgnoreWorkingArea

    Provides information, whether popup is ignoring working area of the display before showing.

    Declaration
    public bool IgnoreWorkingArea { get; set; }
    Property Value
    Type
    System.Boolean

    Items

    Returns the collection of BarItem objects associated with this XPToolBar.

    Declaration
    public BarItems Items { get; }
    Property Value
    Type
    BarItems
    Remarks

    A BarItems collection that represents the list of BarItem objects stored in the XPToolBar.

    You can use this property to obtain a reference to the list of bar items that are currently stored in the XPToolBar. With the reference to the collection of bar items for the XPToolBar (provided by this property), you can add and remove bar items, determine the total number of bar items and clear the list of bar items from the collection.

    Examples

    The following example code adds three bar items to the XPToolBar.

    private void Form_Load(object sender, System.EventArgs e)
    {
    	this.barControl1.Items.Add(this.barItem1);
    	this.barControl1.Items.Add(this.barItem2);
    	this.barControl1.Items.Add(this.parentBarItem1);
    }

    LargeIcons

    Indicates whether the images from the LargeImageList of the BarItems should be used while drawing the BarItems.

    Declaration
    public override bool LargeIcons { get; set; }
    Property Value
    Type Description
    System.Boolean

    True to use the large image list; false to use the default image list. Default value is false.

    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.LargeIcons
    Remarks

    Make sure that a large image list is associated with the BarItem when you set this property to true. Exceptions will be thrown otherwise.

    NeedLayout

    Declaration
    protected bool NeedLayout { get; }
    Property Value
    Type
    System.Boolean

    Office2007Theme

    Gets or sets colorschemes for Office2007 visual style.

    Declaration
    public Office2007Theme Office2007Theme { get; set; }
    Property Value
    Type
    Office2007Theme

    Office2010Theme

    Gets or sets colorschemes for Office2010 visual style.

    Declaration
    public Office2010Theme Office2010Theme { get; set; }
    Property Value
    Type
    Office2010Theme

    PreferredSize

    Returns the preferred size based on the current settings.

    Declaration
    public Size PreferredSize { get; }
    Property Value
    Type Description
    System.Drawing.Size

    A System.Drawing.Size instance.

    RotateWhenVertical

    Gets or sets a value indicating whether items of the XPToolBar will be draws Horizontal when XPToolBar is vertical docked.

    Declaration
    public bool RotateWhenVertical { get; set; }
    Property Value
    Type
    System.Boolean

    SeparatorIndices

    gets the separator indices.

    Declaration
    public VisuallyInheritableIntList SeparatorIndices { get; }
    Property Value
    Type
    VisuallyInheritableIntList

    ShowChevron

    Indicates whether to show chevron.

    Declaration
    public bool ShowChevron { get; set; }
    Property Value
    Type
    System.Boolean

    ShowHighlightRectangle

    Indicates whether to highlight BarItem when mouse moves over it.

    Declaration
    public bool ShowHighlightRectangle { get; set; }
    Property Value
    Type
    System.Boolean

    TabStop

    Gets or sets a value indicating whether the user can give the focus to this control using the TAB key.

    Declaration
    public bool TabStop { get; set; }
    Property Value
    Type
    System.Boolean

    UpdatedBarItemPositions

    Advanced property, meant for use at design-time.

    Declaration
    public IntListDesignTime UpdatedBarItemPositions { get; set; }
    Property Value
    Type
    IntListDesignTime
    Remarks

    Do not use this property directly.

    UpdatedSeparatorPositions

    Advanced property, meant for use at design-time.

    Declaration
    public IntListDesignTime UpdatedSeparatorPositions { get; set; }
    Property Value
    Type
    IntListDesignTime
    Remarks

    Do not use this property directly.

    UpdateUIMFCStyle

    Indicates whether the UpdateUI events for the BarItems should be fired MFC style on Application.Idle.

    Declaration
    public bool UpdateUIMFCStyle { get; set; }
    Property Value
    Type Description
    System.Boolean

    True to fire the UpdateUI event; false otherwise. Default is false.

    Remarks

    Take a look at UpdateUI event description for more information on when and how this pattern should be used.

    Methods

    AfterCodeDomSerialize()

    Declaration
    public void AfterCodeDomSerialize()

    ApplyScaleToControl(Single)

    Scale the control based on the scale factor passed in the argument.

    Declaration
    public void ApplyScaleToControl(float scaleFactor)
    Parameters
    Type Name Description
    System.Single scaleFactor

    value to scale the factor based upon.

    Bar_PropertyChanged(Object, SyncfusionPropertyChangedEventArgs)

    Declaration
    protected override void Bar_PropertyChanged(object sender, SyncfusionPropertyChangedEventArgs e)
    Parameters
    Type Name Description
    System.Object sender
    SyncfusionPropertyChangedEventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.Bar_PropertyChanged(System.Object, Syncfusion.ComponentModel.SyncfusionPropertyChangedEventArgs)

    BeforeCodeDomSerialize()

    Declaration
    public void BeforeCodeDomSerialize()

    BeginGroupAt(BarItem)

    Lets you specify a separator in the BarItems list. The separator will be just before the specified BarItem.

    Declaration
    public void BeginGroupAt(BarItem barItem)
    Parameters
    Type Name Description
    BarItem barItem

    A BarItem present in the Items list.

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.Dispose(System.Boolean)

    GetControlName(String)

    Helps to get the ControlName settings in control.

    Declaration
    public override string GetControlName(string controlName)
    Parameters
    Type Name Description
    System.String controlName
    Returns
    Type
    System.String
    Overrides
    BaseControl.GetControlName(String)

    GetUseControlForeColor()

    Declaration
    protected override bool GetUseControlForeColor()
    Returns
    Type
    System.Boolean
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.GetUseControlForeColor()

    HidePopup()

    Hides the currently open popup.

    Declaration
    public void HidePopup()

    InitBarFromDesigner(BarManager)

    Declaration
    public void InitBarFromDesigner(BarManager manager)
    Parameters
    Type Name Description
    BarManager manager

    IsGroupBeginning(BarItem)

    Indicates whether a separator is drawn just before the specified BarItem.

    Declaration
    public bool IsGroupBeginning(BarItem barItem)
    Parameters
    Type Name Description
    BarItem barItem

    A BarItem present in the Items list.

    Returns
    Type Description
    System.Boolean

    True if there is a separator; false if not.

    IsItemHit(Point)

    Declaration
    public bool IsItemHit(Point ptClient)
    Parameters
    Type Name Description
    System.Drawing.Point ptClient
    Returns
    Type
    System.Boolean

    Layout(IGraphicsProvider)

    Declaration
    protected override void Layout(IGraphicsProvider gp)
    Parameters
    Type Name Description
    IGraphicsProvider gp
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.Layout(Syncfusion.Drawing.IGraphicsProvider)

    MoveMenuNavigation(Boolean)

    Declaration
    public void MoveMenuNavigation(bool forward)
    Parameters
    Type Name Description
    System.Boolean forward

    NeedKey(Keys)

    Declaration
    public override bool NeedKey(Keys key)
    Parameters
    Type Name Description
    System.Windows.Forms.Keys key
    Returns
    Type
    System.Boolean
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.NeedKey(System.Windows.Forms.Keys)

    OnBarBoundsChanged()

    Declaration
    public void OnBarBoundsChanged()

    OnCanApplyThemeChanged(Boolean)

    Helps to apply the CanApplyTheme settings in control.

    Declaration
    public override void OnCanApplyThemeChanged(bool canApplyTheme)
    Parameters
    Type Name Description
    System.Boolean canApplyTheme
    Overrides
    BaseControl.OnCanApplyThemeChanged(Boolean)

    OnCanOverrideStyleChanged(Boolean)

    Helps to apply the CanOverriderStyle settings in control.

    Declaration
    public override void OnCanOverrideStyleChanged(bool canOverriderStyle)
    Parameters
    Type Name Description
    System.Boolean canOverriderStyle
    Overrides
    BaseControl.OnCanOverrideStyleChanged(Boolean)

    OnDockChanged(EventArgs)

    Declaration
    protected override void OnDockChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnDragDrop(DragEventArgs)

    Overridden. See System.Windows.Forms.Control.OnDragDrop(System.Windows.Forms.DragEventArgs).

    Declaration
    protected override void OnDragDrop(DragEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.DragEventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnDragDrop(System.Windows.Forms.DragEventArgs)

    OnDragLeave(EventArgs)

    Overridden. See System.Windows.Forms.Control.OnDragLeave(System.EventArgs).

    Declaration
    protected override void OnDragLeave(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnDragLeave(System.EventArgs)

    OnDragOver(DragEventArgs)

    Overridden. See System.Windows.Forms.Control.OnDragOver(System.Windows.Forms.DragEventArgs).

    Declaration
    protected override void OnDragOver(DragEventArgs drgevent)
    Parameters
    Type Name Description
    System.Windows.Forms.DragEventArgs drgevent
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnDragOver(System.Windows.Forms.DragEventArgs)

    OnFontChanged(EventArgs)

    Declaration
    protected override void OnFontChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnGotFocus(EventArgs)

    Overridden. See System.Windows.Forms.Control.OnGotFocus(System.EventArgs).

    Declaration
    protected override void OnGotFocus(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnGotFocus(System.EventArgs)

    OnHandleCreated(EventArgs)

    Declaration
    protected override void OnHandleCreated(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnHandleCreated(System.EventArgs)

    OnLostFocus(EventArgs)

    Overridden. See System.Windows.Forms.Control.OnLostFocus(System.EventArgs).

    Declaration
    protected override void OnLostFocus(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnMouseDown(MouseEventArgs)

    Overridden. See System.Windows.Forms.Control.OnMouseDown(System.Windows.Forms.MouseEventArgs).

    Declaration
    protected override void OnMouseDown(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnMouseDown(System.Windows.Forms.MouseEventArgs)

    OnPaint(PaintEventArgs)

    Overridden. See System.Windows.Forms.Control.OnPaint(System.Windows.Forms.PaintEventArgs).

    Declaration
    protected override void OnPaint(PaintEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.PaintEventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnPaint(System.Windows.Forms.PaintEventArgs)

    OnPaintBackground(PaintEventArgs)

    Declaration
    protected override void OnPaintBackground(PaintEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.PaintEventArgs e

    OnRotateWhenVerticalChanged()

    Declaration
    protected virtual void OnRotateWhenVerticalChanged()

    OnThemeNameChanged(String)

    Helps to apply the ThemeName settings in control.

    Declaration
    public override void OnThemeNameChanged(string themeName)
    Parameters
    Type Name Description
    System.String themeName

    ThemeName

    Overrides
    BaseControl.OnThemeNameChanged(String)

    ProcessDialogKey(Keys)

    Overridden. See System.Windows.Forms.Control.ProcessCmdKey(System.Windows.Forms.Message@,System.Windows.Forms.Keys).

    Declaration
    protected override bool ProcessDialogKey(Keys keyData)
    Parameters
    Type Name Description
    System.Windows.Forms.Keys keyData
    Returns
    Type
    System.Boolean

    ProcessDragDrop(DragEventArgs)

    Declaration
    protected override void ProcessDragDrop(DragEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.DragEventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.ProcessDragDrop(System.Windows.Forms.DragEventArgs)

    ProcessDragLeave(EventArgs)

    Declaration
    protected override void ProcessDragLeave(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.ProcessDragLeave(System.EventArgs)

    ProcessDragOver(DragEventArgs)

    Declaration
    protected override void ProcessDragOver(DragEventArgs drgevent)
    Parameters
    Type Name Description
    System.Windows.Forms.DragEventArgs drgevent
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.ProcessDragOver(System.Windows.Forms.DragEventArgs)

    ProcessMnemonic(Char)

    Declaration
    protected override bool ProcessMnemonic(char charCode)
    Parameters
    Type Name Description
    System.Char charCode
    Returns
    Type
    System.Boolean
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.ProcessMnemonic(System.Char)

    ProcessShortcut(Keys)

    Forces BarItem to fire The ItemClick event, when specified shortcut for this BarItem entered by the user.

    Declaration
    public void ProcessShortcut(Keys keyData)
    Parameters
    Type Name Description
    System.Windows.Forms.Keys keyData

    Shortcut to process.

    RemoveGroupAt(BarItem)

    Removes the separator just before this BarItem.

    Declaration
    public void RemoveGroupAt(BarItem barItem)
    Parameters
    Type Name Description
    BarItem barItem

    A BarItem present in the Items list.

    RendererChanged(BarRenderer)

    Declaration
    protected override void RendererChanged(BarRenderer rendererNew)
    Parameters
    Type Name Description
    BarRenderer rendererNew
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.RendererChanged(Syncfusion.Windows.Forms.Tools.XPMenus.BarRenderer)

    RequiresActiveFormForMouseTrack()

    Declaration
    protected override bool RequiresActiveFormForMouseTrack()
    Returns
    Type
    System.Boolean
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.RequiresActiveFormForMouseTrack()

    SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)

    Declaration
    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
    Parameters
    Type Name Description
    System.Int32 x
    System.Int32 y
    System.Int32 width
    System.Int32 height
    System.Windows.Forms.BoundsSpecified specified

    SetNeedLayout(Boolean)

    Declaration
    protected void SetNeedLayout(bool value)
    Parameters
    Type Name Description
    System.Boolean value

    ShouldDelegateBGDrawingToParentWhenThemed()

    Specified whether themed background of the parent control will be drawn.

    Declaration
    public override bool ShouldDelegateBGDrawingToParentWhenThemed()
    Returns
    Type
    System.Boolean
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.ShouldDelegateBGDrawingToParentWhenThemed()

    ShouldPreProcessTab()

    Overrides the ShouldPreProcessTab method.

    Declaration
    public override bool ShouldPreProcessTab()
    Returns
    Type
    System.Boolean
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.ShouldPreProcessTab()

    ShowPopup(ParentBarItem)

    Shows the popup of the specified item.

    Declaration
    public void ShowPopup(ParentBarItem item)
    Parameters
    Type Name Description
    ParentBarItem item

    Parent bar item to show popup items.

    SubscribeDragDrop()

    Declaration
    protected void SubscribeDragDrop()

    UnSubscribeDragDrop()

    Declaration
    protected void UnSubscribeDragDrop()

    UpdateColorScheme()

    Declaration
    protected override void UpdateColorScheme()
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.UpdateColorScheme()

    UpdateSeparatorIndices()

    Declaration
    protected virtual void UpdateSeparatorIndices()

    WndProc(ref Message)

    Overridden. See System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message@).

    Declaration
    protected override void WndProc(ref Message m)
    Parameters
    Type Name Description
    System.Windows.Forms.Message m
    Overrides
    Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.WndProc(System.Windows.Forms.Message)

    Explicit Interface Implementations

    IDesignable.DesignMode

    Declaration
    bool IDesignable.DesignMode { get; }
    Returns
    Type
    System.Boolean

    IVisualStyle.VisualTheme

    Declaration
    string IVisualStyle.VisualTheme { get; set; }
    Returns
    Type
    System.String

    Implements

    IThemeProvider
    System.IDisposable
    IBarControl
    IThemedControl
    ICallWndProcListener
    IBarHost
    IDesignable
    IIgnoreWorkingArea
    IVisualStyle
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved