Skip to content

If implementing INavigationAware in a Page, the methods are being called twice, redundantly. #636

@bbsuuo

Description

@bbsuuo

Describe the bug

If implementing INavigationAware in a Page, the methods are being called twice, redundantly,
To reproduce this issue, I have inherited INavigationAware in the AllControlsPage under the Wpf.Ui.Gallery folder. Then, I have output some information in the OnNavigatedTo method, and this information is being output twice

To Reproduce

public partial class AllControlsPage : INavigableView , INavigationAware
{
public AllControlsViewModel ViewModel { get; }

public AllControlsPage(AllControlsViewModel viewModel)
{
    ViewModel = viewModel;
    DataContext = this;

    InitializeComponent();
}

public void OnNavigatedTo()
{
    Debug.WriteLine("==== NavigatedTo");
}
public void OnNavigatedFrom()
{

}

}

we can show debug output :
==== NavigatedTo
==== NavigatedTo****

Expected behavior

There is an error with INavigationAware on the page class

Screenshots

No response

OS version

window

.NET version

net7.0

WPF-UI NuGet version

github source code now

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions