ThemedWindow.ToolbarItemTemplateSelector Property
Gets or sets the object that chooses the current ThemedWindow‘s toolbar item template based on custom logic. This is a dependency property.
Namespace: DevExpress.Xpf.Core
Assembly: DevExpress.Xpf.Core.v24.2.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
Property Value
Type | Description |
---|---|
DataTemplateSelector | A DataTemplateSelector object that chooses the current ThemedWindow‘s toolbar item template based on custom logic. |
Remarks
A selector assigned to the ToolbarItemTemplateSelector property chooses a template and applies it to toolbar items (see the ThemedWindow.ToolbarItems property) of this ThemedWindow. To explicitly select a required template, assign it to the ThemedWindow.ToolbarItemTemplate property. Refer to the Choosing Templates Based on Custom Logic topic for more information.
Note
The ToolbarItemTemplate property applies to all objects except UIElements objects.
The following code sample shows how to add ThemedWindow Toolbar Items and use the ToolbarItemTemplateSelector property:
<dx:ThemedWindow
...
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core">
<dx:ThemedWindow.Resources>
<DataTemplate x:Key="BlueBorderTemplate" >
<Border Margin="1" Background="Blue">
<TextBlock Margin="5" Foreground="Yellow" Text="{Binding}" />
</Border>
</DataTemplate>
<DataTemplate x:Key="OrangeBorderTemplate">
<Border Margin="1" Background="Orange">
<TextBlock Margin="5" Foreground="Green" Text="{Binding}" />
</Border>
</DataTemplate>
</dx:ThemedWindow.Resources>
<dx:ThemedWindow.ToolbarItemTemplateSelector>
<local:SampleTemplateSelector/>
</dx:ThemedWindow.ToolbarItemTemplateSelector>
<dx:ThemedWindow.ToolbarItemsSource>
<dx:ThemedWindowHeaderItemsCollection>
<system:String>code_1</system:String>
<system:String>code_2</system:String>
<system:String>code_3</system:String>
<Button Content="SimpleButton"/>
</dx:ThemedWindowHeaderItemsCollection>
</dx:ThemedWindow.ToolbarItemsSource>
</dx:ThemedWindow>
Note
In this code snippet, the ToolbarItemTemplate property applies to all objects except the Button control.
The image below illustrates the result: