Skip to main content
Bar

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ToolBarControlBase.Items Property

Provides access to the collection of bar items displayed in the current ToolBarControlBase.

Namespace: DevExpress.Xpf.Bars

Assembly: DevExpress.Xpf.Core.v24.2.dll

NuGet Package: DevExpress.Wpf.Core

#Declaration

public ObservableCollection<IBarItem> Items { get; }

#Property Value

Type Description
ObservableCollection<DevExpress.Xpf.Bars.IBarItem>

A ObservableCollection<T><DevExpress.Xpf.Bars.IBarItem,> object that represents the collection of bar items displayed in the current ToolBarControlBase.

#Remarks

Add BarItem and/or BarItemLinkBase descendants to the Items collection to display corresponding items in the current ToolBarControlBase control. In XAML, you can define items directly between the start and end tags of the ToolBarControlBase control descendants.

xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"

<dxb:MainMenuControl x:Name="mainMenu" Caption="MainMenu">
    <dxb:BarSubItem Content="File">
        <dxb:BarItemLink BarItemName="bNew"/>
        <dxb:BarItemLink BarItemName="bOpen"/>
        <dxb:BarItemLink BarItemName="bSave"/>
        <dxb:BarItemLink BarItemName="bSaveAs"/>
        <dxb:BarItemSeparator/>
        <dxb:BarItemLink BarItemName="bPrint"/>
        <dxb:BarItemSeparator/>
        <dxb:BarButtonItem Content="Close" Glyph="{dx:DXImage Image=Close_16x16.png}"/>
    </dxb:BarSubItem>
</dxb:MainMenuControl>

<dxb:ToolBarControl x:Name="fileToolBar" Caption="File" AllowCustomizationMenu="True" ShowBackground="False" Background="Red">
    <dxb:BarButtonItem Name="bNew" Content="New" Glyph="{dx:DXImage Image=New_16x16.png}" LargeGlyph="{dx:DXImage Image=New_32x32.png}"/>
    <dxb:BarButtonItem Name="bOpen" Content="Open" Glyph="{dx:DXImage Image=Open_16x16.png}" LargeGlyph="{dx:DXImage Image=Open_32x32.png}"/>
    <dxb:BarButtonItem Name="bSave" Content="Save" Glyph="{dx:DXImage Image=Save_16x16.png}" LargeGlyph="{dx:DXImage Image=Save_32x32.png}"/>
    <dxb:BarButtonItem Name="bSaveAs" Content="Save As" Glyph="{dx:DXImage Image=SaveAs_16x16.png}" LargeGlyph="{dx:DXImage Image=SaveAs_32x32.png}"/>
    <dxb:BarItemLinkSeparator/>
    <dxb:BarButtonItem Name="bPrint" Content="Print" Glyph="{dx:DXImage Image=Print_16x16.png}" LargeGlyph="{dx:DXImage Image=Print_32x32.png}" Alignment="Far"/>
</dxb:ToolBarControl>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Items property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also