Back to Devexpress

PageHeaderButton Class

wpf-devexpress-dot-xpf-dot-ribbon-31ae9cb6.md

latest4.0 KB
Original Source

PageHeaderButton Class

Contains properties to change Page Header Button appearance.

Namespace : DevExpress.Xpf.Ribbon

Assembly : DevExpress.Xpf.Ribbon.v25.2.dll

NuGet Package : DevExpress.Wpf.Ribbon

Declaration

csharp
public class PageHeaderButton :
    Button,
    IBarsNavigationSupport,
    IBarsNavigationCompatibility,
    INavigationElement
vb
Public Class PageHeaderButton
    Inherits Button
    Implements IBarsNavigationSupport,
               IBarsNavigationCompatibility,
               INavigationElement

Example

The following code example displays the Page Header Button in the header area:

xml
<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>

csharp
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
    });
}

Inheritance

Show 11 items

Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control ContentControl ButtonBase Button PageHeaderButton

See Also

PageHeaderButton Members

DevExpress.Xpf.Ribbon Namespace