Back to Devexpress

PageAdornerControl.BackCommand Property

wpf-devexpress-dot-xpf-dot-windowsui-dot-pageadornercontrol-2f24fd51.md

latest3.7 KB
Original Source

PageAdornerControl.BackCommand Property

Gets or sets the command associated with the PageAdornerControl‘s Back Button.

Namespace : DevExpress.Xpf.WindowsUI

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

NuGet Package : DevExpress.Wpf.Controls

Declaration

csharp
public ICommand BackCommand { get; set; }
vb
Public Property BackCommand As ICommand

Property Value

TypeDescription
ICommand

An ICommand object that is the command associated with the PageAdornerControl‘s Back Button.

|

Remarks

Use the PageAdornerControl.ShowBackButton property to display or hide the PageAdornerControl‘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.

csharp
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);
    pageAdornerControl1.BackCommand = cmdBack;
    pageAdornerControl1.ShowBackButton = true;
}
vb
Private Function canExecuteFunc() As Boolean
    'checks specific conditions and determines whether our custom command can be executed in its current state
    If ... Then
    Return True
    Else
        Return False
    End If
End Function

Private Sub executeFunc()
    'performs specific actions
    . . .
End Sub

Public Sub myView1()
    InitializeComponent()
    'defines the custom command and assigns it to the container's back button
    Dim cmdBack As DevExpress.Mvvm.DelegateCommand = New DevExpress.Mvvm.DelegateCommand(AddressOf executeFunc, AddressOf canExecuteFunc)
    pageAdornerControl1.BackCommand = cmdBack
    pageAdornerControl1.ShowBackButton = True
End Sub

See Also

ShowBackButton

BackNavigationMode

Navigation

PageAdornerControl Class

PageAdornerControl Members

DevExpress.Xpf.WindowsUI Namespace