Let’s create two buttons. The first one, button1, opens a new ContentPage with animation.
var button1 = new Button {
Text = "Push with animation",
Command = new Command(() => MainPage.Navigation.PushAsync(new ContentPage())),
};
The second one, button2, uses a second argument to PushAsync. Setting animated to false disables the page transition animation.
var button2 = new Button {
Text = "Push without animation",
Command = new Command(() => MainPage.Navigation.PushAsync(new ContentPage(), animated: false)),
};
Placing both buttons in a StackLayout on a ContentPage nested in a NavigationPage lets us experiment with both behaviors.
MainPage = new NavigationPage(new ContentPage {
Content = new StackLayout {
Children = {
button1,
button2,
},
},
});