Skip to main content
A newer version of this page is available. .

HamburgerMenu.HeaderTemplate Property

Gets or sets the data template used to render the menu header.

Namespace: DevExpress.Xpf.WindowsUI

Assembly: DevExpress.Xpf.Controls.v20.2.dll

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Controls, DevExpress.Wpf.Navigation

Declaration

public DataTemplate HeaderTemplate { get; set; }

Property Value

Type Description
DataTemplate

A DataTemplate object that specifies the data template used to render the menu header.

Remarks

Set the menu header with the HamburgerMenu.Header property. The HeaderTemplate and HamburgerMenu.HeaderTemplateSelector properties allow you to specify how the data object is rendered. If no data template is specified, the string representation of the object is used.

The following header template implementation provides the Search button in different menu’s view states.

<UI:HamburgerMenu.HeaderTemplate>
                <DataTemplate>
                    <Grid Name="root" HorizontalAlignment="Left">
                        <TextBlock Text="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                        <Button Content="Search" Name="button" HorizontalAlignment="Right" Visibility="Collapsed" Margin="0,0,30,0"/>
                    </Grid>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=(UI:HamburgerMenu.TemplateSettings).ViewState, RelativeSource={RelativeSource Mode=Self}}" Value="Closed">
                            <Setter TargetName="root" Property="HorizontalAlignment" Value="Stretch"/>
                            <Setter TargetName="button" Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=(UI:HamburgerMenu.TemplateSettings).ViewState, RelativeSource={RelativeSource Mode=Self}}" Value="Opened">
                            <Setter TargetName="root" Property="HorizontalAlignment" Value="Stretch"/>
                            <Setter TargetName="button" Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
            </UI:HamburgerMenu.HeaderTemplate>
See Also