wpf-devexpress-dot-xpf-dot-ribbon-dot-ribboncontrol-a8720692.md
Gets or sets the command executed by the RibbonControl when the Page Header Button is clicked. This is a dependency property.
Namespace : DevExpress.Xpf.Ribbon
Assembly : DevExpress.Xpf.Ribbon.v25.2.dll
NuGet Package : DevExpress.Wpf.Ribbon
public ICommand PageHeaderButtonCommand { get; set; }
Public Property PageHeaderButtonCommand As ICommand
| Type | Description |
|---|---|
| ICommand |
The command executed when a user clicks the Page Header Button.
|
Use the PageHeaderButtonCommand property to associate an action with the Page Header Button. Set the ShowPageHeaderButton property to true to display the button.
The following code example displays the Page Header Button in the header area:
<dx:ThemedWindow
x:Class="Demo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="MainWindow" Height="800" Width="800">
<dx:ThemedWindow.Resources>
<!-- Custom style for Page Header Button -->
<Style TargetType="dxr:PageHeaderButton">
<Setter Property="Margin" Value="5,0"/>
<Setter Property="Padding" Value="8,4"/>
<Setter Property="CornerRadius" Value="7"/>
<Setter Property="GlyphWidth" Value="32"/>
<Setter Property="GlyphHeight" Value="32"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E3F2FD"/>
</Trigger>
</Style.Triggers>
</Style>
</dx:ThemedWindow.Resources>
<Grid>
<dxr:RibbonControl
RibbonStyle="Office2019"
ShowPageHeaderButton="True"
PageHeaderButtonToolTip="Show or hide navigation"
PageHeaderButtonGlyph="pack://application:,,,/Icons/Hamburger.svg"
PageHeaderButtonCommand="{Binding ToggleNavigationPanelCommand}"
PageHeaderButtonCommandParameter="{x:Boolean True}" />
</Grid>
</dx:ThemedWindow>
public sealed class MainViewModel {
public bool IsNavigationVisible { get; set; } = false;
public ICommand ToggleNavigationPanelCommand => new DevExpress.Mvvm.DelegateCommand<object>(p => {
if (p is bool force)
IsNavigationVisible = force;
else
IsNavigationVisible = !IsNavigationVisible; // Hides or displays the button if the parameter is null
});
}
See Also