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

NavigationViewModelBase Class

A View Model for Views between which navigation can be organized if they are placed within a NavigationFrame.

Namespace: DevExpress.Mvvm

Assembly: DevExpress.Mvvm.v18.1.dll

Declaration

public abstract class NavigationViewModelBase :
    ViewModelBase,
    ISupportNavigation,
    ISupportParameter

Remarks

The NavigationViewModelBase class implements the ISupportNavigation interface, which adds the OnNavigatedTo and OnNavigatedFrom methods to the class. When deriving your ViewModel from the NavigationViewModelBase class, you can override these methods to perform actions when a View is activated or deactivated during navigation.

Example

The FrameNavigationService provides methods to navigate between Views within a NavigationFrame. This example shows how to use this service.In this example, the MainWindow contains a NavigationFrame, which shows a HomeView at startup. The HomeView contains a Tile, which invokes a command to navigate to a DetailView when clicked. The DetailView contains the Back button for backward navigation.

<UserControl x:Class="DXSample.View.MainView" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui"
    xmlns:dxwuin="http://schemas.devexpress.com/winfx/2008/xaml/windowsui/navigation"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" 
    xmlns:ViewModel="clr-namespace:DXSample.ViewModel" 
    mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" 
    DataContext="{dxmvvm:ViewModelSource Type={x:Type ViewModel:MainViewModel}}">
    <Grid>
        <dxwui:NavigationFrame AnimationType="SlideHorizontal" NavigationCacheMode="Required">
            <dxmvvm:Interaction.Triggers>
                <dxmvvm:EventToCommand EventName="Loaded" Command="{Binding OnViewLoadedCommand}" />
            </dxmvvm:Interaction.Triggers>
            <dxmvvm:Interaction.Behaviors>
                <dxwuin:FrameNavigationService />
            </dxmvvm:Interaction.Behaviors>
        </dxwui:NavigationFrame>
    </Grid>
</UserControl>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the NavigationViewModelBase class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
BindableBase
ViewModelBase
NavigationViewModelBase
See Also