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

HamburgerMenu.HeaderTemplate Property

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

Namespace: DevExpress.Xpf.WindowsUI

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

NuGet Package: DevExpress.Wpf.Controls

#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