How to implement NavigationPageRenderer of Xamarin.Forms to handler/mapper in .NET MAUI

62 views Asked by At

In Xamarin Forms I had a NavigationPageRenderer to disable animations when navigating to other pages or deleting them, but I don't know how I can implement the same thing in .NET MAUI using Handlers/Mapper. I saw a similar issue on Github Issues but it didn't help me. I also tried to follow the documentation without any success.

NavigationPageRenderer is deprecated in MAUI

The code in Xamarin.Forms

.netstandard

public class CustomNavigationPage : NavigationPage
{
    public CustomNavigationPage(Page mainPage) : base(mainPage)
    {
    }
}

Droid

[assembly: ExportRenderer(typeof(CustomNavigationPage), typeof(CustomNavigationPageRenderer))]
namespace AppSample.Droid

    public class CustomNavigationPageRenderer : NavigationPageRenderer
    {
        public CustomNavigationPageRenderer(Context context) : base(context)
        {

        }

        protected override Task<bool> OnPushAsync(Page view, bool animated)
        {
            return base.OnPushAsync(view, false);
        }

        protected override Task<bool> OnPopViewAsync(Page page, bool animated)
        {
            return base.OnPopViewAsync(page, false);
        }

        protected override Task<bool> OnPopToRootAsync(Page page, bool animated)
        {
            return base.OnPopToRootAsync(page, false);
        }
    }

usage

    public App()
    {
        MainPage = new CustomNavigationPage(new MainPage());
    }
0

There are 0 answers