Skip to main content

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

ThemedWindow.ToolbarItems Property

Gets the toolbar items collection displayed in the current ThemedWindow. This is a dependency property.

Namespace: DevExpress.Xpf.Core

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

NuGet Package: DevExpress.Wpf.Core

#Declaration

public ObservableCollection<object> ToolbarItems { get; }

#Property Value

Type Description
ObservableCollection<Object>

A toolbar items collection.

#Remarks

Create a HeaderItemControl object and add it to the ToolbarItems collection to display an item within the ThemedWindow toolbar area.

ToolbarItems and HeaderItems are not intended to be used with the integrated RibbonControl or DXTabControl.

Note

When the ToolbarItemsSource property is specified, the ThemedWindow ignores the ToolbarItems property.

The following code snippet shows how to add multiple toolbar items to a ThemedWindow in code:

using DevExpress.Xpf.Bars;
using System.Windows;

MainMenuControl menuControl = new MainMenuControl() { VerticalAlignment = VerticalAlignment.Center, ShowBackground = false };

BarSubItem subItem0 = new BarSubItem() { Content = "File"};
subItem0.Items.Add(new BarButtonItem() { Content = "New" });
subItem0.Items.Add(new BarButtonItem() { Content = "Open" });
subItem0.Items.Add(new BarButtonItem() { Content = "Exit" });

BarSubItem subItem1 = new BarSubItem() { Content = "Edit" };
subItem1.Items.Add(new BarButtonItem() { Content = "Copy" });
subItem1.Items.Add(new BarButtonItem() { Content = "Paste" });

menuControl.Items.Add(subItem0);
menuControl.Items.Add(subItem1);
menuControl.Items.Add(new BarButtonItem() { Content = "Help" });

ToolbarItems.Add(menuControl);

The following code sample shows how to add the same toolbar items to a ThemedWindow in XAML:

<dx:ThemedWindow Title="ApplicationName" 
...
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars">
<dx:ThemedWindow.ToolbarItems>            
    <dxb:MainMenuControl VerticalAlignment="Center" ShowBackground="False">
        <dxb:BarSubItem Content="File">
            <dxb:BarButtonItem Content="New" />
            <dxb:BarButtonItem Content="Open" />
            <dxb:BarButtonItem Content="Exit" />
        </dxb:BarSubItem>
        <dxb:BarSubItem Content="Edit">
            <dxb:BarButtonItem Content="Copy" />
            <dxb:BarButtonItem Content="Paste" />
        </dxb:BarSubItem>
        <dxb:BarButtonItem Content="Help" />
    </dxb:MainMenuControl>
</dx:ThemedWindow.ToolbarItems>
</dx:ThemedWindow>

The image below illustrates the result:

Themed Window - Toolbar Items property

See Also