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

PageView.BackCommand Property

Gets or sets the command assigned to the PageView‘s Back Button.

Namespace: DevExpress.Xpf.WindowsUI

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

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

Declaration

public ICommand BackCommand { get; set; }

Property Value

Type Description
ICommand

An ICommand object that is the command assigned to the PageView‘s Back Button.

Remarks

Use the PageView.ShowBackButton property to display or hide the PageView‘s Back Button. By default, clicking a Back Button will navigate to either the previous view, or to root view depending on the NavigationFrame.BackNavigationMode property value of a NavigationFrame container involved in navigation. See the Navigation topic to learn more.

You can assign your own command to the Back Button via the BackCommand property. The code below demonstrates the example.

private bool canExecuteFunc() {
    //checks specific conditions and determines whether our custom command can be executed in its current state
    if (. . .) return true;
    else return false;
}

private void executeFunc() {
    //performs specific actions
    . . .
}

public myView1() {
    InitializeComponent();
    //defines the custom command and assigns it to the container's back button
    DevExpress.Mvvm.DelegateCommand cmdBack = new DevExpress.Mvvm.DelegateCommand(executeFunc, canExecuteFunc);
    pageView1.BackCommand = cmdBack;
    pageView1.ShowBackButton = true;
}
See Also