Navigation animation Without shell

Ángel Rubén Valdeolmos Carmona 586 Reputation points
2021-03-03T10:08:04.707+00:00

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?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,313 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,951 Reputation points
    2021-03-03T13:17:50.923+00:00

    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful