Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation Services Not working #1720

Open
dksingh605 opened this issue Dec 17, 2019 · 1 comment
Open

Navigation Services Not working #1720

dksingh605 opened this issue Dec 17, 2019 · 1 comment
Assignees
Labels

Comments

@dksingh605
Copy link

Hi
i am using these two methods(OnNavigatedToAsync,OnNavigatedFromAsync) in the view model,

when i am navigating to NavigateService then these two method was called.
but when i am navigating using Frame.Navigate method this will not work.
please help

@JerryNixon
Copy link
Member

Assuming you are using version 2.0.1?

I think you will need to show me a little more code.

That said, let me ask this though:

Are you implementing the interfaces? This is important.

Here's the source: INavigatedAware or INavigatedAwareAsync

It's easiest if you use the ViewModelBase class, but that's not required.

Here's a sample view-model:

public class MyViewModel : INavigationAware
{
    public void OnNavigatedFrom(INavigationParameters parameters)
    {
        throw new NotImplementedException();
    }

    public void OnNavigatedTo(INavigationParameters parameters)
    {
        throw new NotImplementedException();
    }

    public void OnNavigatingTo(INavigationParameters parameters)
    {
        throw new NotImplementedException();
    }
}

The framework only knows to call these methods if it determines the interfaces are present.

If you are interested, here's where the framework actually does that.

@JerryNixon JerryNixon self-assigned this Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants