How to navigate from one ContentPage to another in Xamarin.Forms

Xamarin.Forms
img_xamarin

The following Demo Are For basic methods to navigate from one ContentPage to another.

Now Create New Solution.

xf6.1

The MainPage is initialized with a MainView, which we will define below, wrapped into a NavigationPage, which will create a navigation bar above the content.

Now Open The NavigationSegueXamarinForms.cs and Initialize NavigationBar.

From Above Code We Are Redirect To the MainView and Add the Navigation Over That Page.

Now Open The MainView.cs File and Define the Button in that File. Below Code For Define Button.

Here We give The Button Name To ‘btn_PushAsync’ and Give That Button text to ‘PushAsync’.

Next We Perform The Click Event On btn_PushAsync Button.Below Code For Button Click Event.

When We Click On PushAsync Button It Will Redirect to SecondPage

Next We Put That Button To View

Now Create a New File ‘SecondPage’.So When user Click On PushAsync Button That Redirect to This SecondPage.

xf6.2

Now Open The SecondPage.cs File and Define More Button on That and Also Perform The Click Event of All Button. Below Code For That.

Now Our app is Ready to Run.Lets Run The App.

In Ios Device.

xf6.3

xf6.4

In Android Device.

xf6.5

xf6.6

If you like this tutorial then you can download full copy of the code from github

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">