Handling iOS Back button in Prism (MAUI) - Stack Overflow

We have a Prism MAUI app that is deployed to Android and iOS. In some of the ViewModels I would like to

We have a Prism MAUI app that is deployed to Android and iOS. In some of the ViewModels I would like to be able to catch back navigation using the Prism interface IConfirmNavigationAsync.

This works perfectly in Android but in iOS it never gets called.

When the Back button is pressed in iOS I see this message in the debug output

NavigationPage has encountered an unhandled GoBack. Be sure to inherit from PrismNavigationPage.

That is thrown by the NavigationPageSystemGoBackBehavior when the PageNavigationService.NavigationSource == Device. This makes me think that I should be handling that Back button myself or offering up a Prism one but I don't know how to do that.

FWIW the following fire just fine

  • OnNavigatedFrom
  • IDestructible.Destroy
  • OnDisappearing

We initialise Prism like this:

static void BuildPrism(PrismAppBuilder prism)
{
    Type viewModelToShow = null;

    viewModelToShow = typeof(HomeViewModel);

    prism.CreateWindow(
                string.Format("NavigationPage/{0}", viewModelToShow.Name),
                HandleNavigationError);
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744389477a4571833.html

相关推荐

  • Handling iOS Back button in Prism (MAUI) - Stack Overflow

    We have a Prism MAUI app that is deployed to Android and iOS. In some of the ViewModels I would like to

    7天前
    80

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信