1) Go to APP.xaml.cs page and update as below
public App()
{
InitializeComponent();
MainPage = new NavigationPage(new MainPage());
}
2) Create New page (NavigationPageEXP1)
3) Go to Mainpage.xaml and add below code
<ScrollView>
<VerticalStackLayout>
<Label Text="Main Page"
FontSize="12" />
<Button
x:Name="BtnNavigation"
Text="Go to Navigation Page EXP1"
Clicked="BtnNavigation_Clicked"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ScrollView>
4) Go to Mainpage.xaml.cs and add below code
private void BtnNavigation_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new NavigationPageEXP1());
}
5) Go to NavigationPageEXP1.xaml and add below code
<VerticalStackLayout>
<Label
Text="Welcome to Navigation Page EXP1 !"
VerticalOptions="Center"
HorizontalOptions="Center" />
<Button
x:Name="BtnNavigation"
Text="Go to Main Page"
Clicked="BtnNavigation_Clicked"
HorizontalOptions="Center" />
</VerticalStackLayout>
6) Go to NavigationPageEXP1.xaml.cs and add below code
private void BtnNavigation_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new MainPage());
}
Output:
Main Page:
NavigationPageEXP1:
No comments:
Post a Comment