Back to Devexpress

ToolBarControlBase.Items Property

wpf-devexpress-dot-xpf-dot-bars-dot-toolbarcontrolbase-53025432.md

latest4.5 KB
Original Source

ToolBarControlBase.Items Property

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

Namespace : DevExpress.Xpf.Bars

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public ObservableCollection<IBarItem> Items { get; }
vb
Public ReadOnly Property Items As ObservableCollection(Of IBarItem)

Property Value

TypeDescription
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.

xaml
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.

wpf-docklayoutmanager-merge-bars-in-controls-that-support-automatic-merging/CS/WpfApplication1/MainWindow.xaml#L13

xml
<dxb:MainMenuControl Caption="File" DockPanel.Dock="Top">
    <dxb:MainMenuControl.Items>
        <dxb:BarButtonItem Content="MDI" ItemClick="biMDI_ItemClick" MergeOrder="3"/>

See Also

ItemsSource

ToolBarControlBase Class

ToolBarControlBase Members

DevExpress.Xpf.Bars Namespace