Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Navigating to page containing ToolbarItems via PushModalAsync & PushAsync

$
0
0

I am trying to understand difference between PushModalAsync & PushAsync Navigation. In my code I am using this interchangeably in many places without any care. But then, now I am facing some issue (may be not issue with Xamarin) with ToolbarItems, PushModalAsync & PushAsync. I have below code.

public partial class HomePage : ContentPage
    {   
        public HomePage ()
        {
            InitializeComponent ();

            this.ToolbarItems.Add(new ToolbarItem("Login", "", async () =>
                {
                    Navigation.PushModalAsync(new LoginPage(null));
                }));
            this.ToolbarItems.Add(new ToolbarItem("Create Account", "", async () =>
                {
                    Navigation.PushModalAsync(new CreateAccountPage(null));
                }));
        }
    }

When I Navigate to above page via PushAsync, ToolbarItems are shown, but if I Navigate via PushModalAsync ToolbarItems gets removed. I want to know when to use what, as I am not getting enough clarity from documentation (sorry, dumb I am), as it says, PushModalAsync will display the page modally.


Viewing all articles
Browse latest Browse all 58056

Trending Articles