ThemedWindow.HeaderItemTemplateSelector Property
Gets or sets the object that chooses the current ThemedWindow‘s header 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 header item template based on custom logic. |
Remarks
A selector assigned to the HeaderItemTemplateSelector property chooses a template and applies it to header items (see the ThemedWindow.HeaderItems property) of this ThemedWindow. To explicitly select a required template, assign it to the ThemedWindow.HeaderItemTemplate property. Refer to the Choosing Templates Based on Custom Logic topic for more information.
Note
The HeaderItemTemplate property applies to all objects except UIElements objects.
The following code sample shows how to add ThemedWindow Header Items and use the HeaderItemTemplateSelector 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.HeaderItemTemplateSelector>
<local:SampleTemplateSelector/>
</dx:ThemedWindow.HeaderItemTemplateSelector>
<dx:ThemedWindow.HeaderItemsSource>
<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.HeaderItemsSource>
</dx:ThemedWindow>
Note
In this code snippet, the HeaderItemTemplate property applies to all objects except the Button control.
The image below illustrates the result: