question

Angelru-4290 avatar image
0 Votes"
Angelru-4290 asked ·

Navigation animation Without shell

When navigating to another page from Shell there is a full page right to left animation including navigation bar, how can I achieve this without using Shell?

dotnet-xamarinforms
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
0 Votes"
JarvanZhang-MSFT answered ·

Hello,​

Welcome to our Microsoft Q&A platform!

When navigating to another page from Shell there is a full page right to left animation including navigation bar

Try to create custom NavigationPage renderer to define the style of page transaction. For example, here is the related code on Android platform:

[assembly: ExportRenderer(typeof(CustomNavigationPage), typeof(CustonNavigationRenderer))]
namespace TestApplication_4.Droid
{
    public class CustonNavigationRenderer : NavigationPageRenderer
    {
        public CustonNavigationRenderer(Context context) : base(context)
        {
        }

        protected override void SetupPageTransition(AndroidX.Fragment.App.FragmentTransaction transaction, bool isPush)
        {
            //base.SetupPageTransition(transaction, isPush);
            if (isPush)
            {
                transaction.SetCustomAnimations(Resource.Animation.EnterFromRight, Resource.Animation.ExitToLeft,
                                                Resource.Animation.EnterFromLeft, Resource.Animation.ExitToRight);
            }
            else
            {
                transaction.SetCustomAnimations(Resource.Animation.EnterFromLeft, Resource.Animation.ExitToRight,
                                                Resource.Animation.EnterFromRight, Resource.Animation.ExitToLeft);
            }
        }
    }
}


Best Regards,

Jarvan Zhang



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.