Introduction
This article demonstrates Multiple Button Navigation In Xamarin.Forms applications. Xamarin is a platform that allows us to create a multi-platform mobile application for platforms, like Android, Windows, IOS through a single integrated development environment (IDE).

Let's start.
Step 1
Open Visual Studio and go to New Project >> Installed >> Visual C# >> Cross-Platform.
Select Cross-Platform app, then give your project a name and location.
Step 2
Open Solution Explorer >> Project Name (Portable) >> App.xaml.cs >> Double click will open the design view of this page.
The code is given below.
C# Code
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Xamarin.Forms;
- namespace Navigation
- {
- public partial class App : Application
- {
- public App()
- {
- InitializeComponent();
- MainPage = new NavigationPage(new MainPage());
- }
- protected override void OnStart()
- {
- // Handle when your app starts
- }
- protected override void OnSleep()
- {
- // Handle when your app sleeps
- }
- protected override void OnResume()
- {
- // Handle when your app resumes
- }
- }
- }
Step 3
Next, add an image to Solution Explorer >> Project Name.Android >> Resources >> Right-Click >> drawable >> Add >> Existing Item.
Next, a dialogue box will open. Choose image location and add images.
The images are added successfully.
Step 4
Next, Open Solution Explorer >> Project Name (Portable) >> Right-Click >> Add >> New Item or Ctrl+Shift+A.
A new dialogue box will open. Now, add the XAML page and give it a name. Click the "Add" button.
Similarly, add the XAML page and give your name. "Page 2"
Similarly, add the XAML page and give your name. "Page 3"
Step 5
Open Solution Explorer >> Project Name >> Mainpage.xaml. Open the design view of this page.
The code is given below.
Xaml Code
We are creating three buttons inside the StackLayout. "Android, Windows, Ios".
- <?xml version="1.0" encoding="utf-8" ?>
- <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- xmlns:local="clr-namespace:Navigation"
- x:Class="Navigation.MainPage">
- <ContentPage.Content>
- <StackLayout>
- <Button Text="Android" Clicked="Button_Clicked"/>
- <Button Text="Windows" Clicked="Button_Clicked_1"/>
- <Button Text="Ios" Clicked="Button_Clicked_2"/>
- </StackLayout>
- </ContentPage.Content>
- </ContentPage>




Salman KhanPosted Jan 9, 2019, 4:19 AM
You have not shown how that back button is working?