Skip to content

Navigated event on IRegionNavigationService not firing. #2348

Answered by jevenson
jevenson asked this question in WPF
Discussion options

You must be logged in to vote

I found a solution to my problem.

In my MainWindowViewModel I inject the IRegionManager & IRegionNavigationService. In the view, I bind the Loaded event to a LoadedCommand, which sets the Region on the IRegionNavigationService, sets up an event handler for the Navigated event, and then navigates to the initial view of the app. Then, when viewmodels need to navigate, I get a reference to the same IRegionNavigationService from the NavigationContext parameter from the INavigationAware.NavigatedTo function.

MainWindowViewModel

public DelegateCommand LoadedCommand { get; private set; }

public MainWindowViewModel(IRegionManager regionManager, IRegionNavigationService regionNavService)
{ 
    this

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jevenson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
WPF
Labels
None yet
1 participant