How to call the previous page function in MAUI?

Viewed 28

My problem: My parent page (AdminPanel.xaml) contains a function: updateAllMaterialList()

It's the page previous one on the navigation stack.

Now on the AddUser.xaml page, I try to navigate back by calling updateAllMaterialList() like this:

    private async void GoToBack(object sender, EventArgs e)
    {
    await Navigation.PopAsync();

    NavigationPage navPage = (NavigationPage)App.Current.MainPage;
    Page page = navPage.Navigation.NavigationStack[navPage.Navigation.NavigationStack.Count - 1];
    ((AdminPanel)page).updateAllMaterialList();

    }

But it doesn't work

0 Answers
Related