日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

xamarin跳转html,Xamarin 页面跳转

發布時間:2023/12/20 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 xamarin跳转html,Xamarin 页面跳转 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

簡介

Xamarin.Forms提供了許多不同的頁面導航體驗,具體取決于所使用的頁面類型

對于ContentPage實例,有兩種導航體驗:

Hierarchical Navigation

Modal Navigation

Hierarchical Navigation

NavigationPage類提供了一種分層導航體驗,用戶可以根據需要在頁面中進行導航,向前和向后導航

該類實現導航作為Page對象的后進先出(LIFO)堆棧

在分層導航中,NavigationPage類用于瀏覽一堆ContentPage對象

要從一個頁面移動到另一個頁面,應用程序會將新頁面推到導航堆棧上,在那里它將成為活動頁面

要返回到上一頁面,應用程序將從導航堆棧中彈出當前頁面,并且新的最頂端頁面將成為活動頁面

根頁面設置為NavigationPage

添加到導航堆棧的第一個頁面被稱為應用程序的根頁面

在App中修改起始頁的設置

MainPage = new NavigationPage(new MainPage());

跳轉頁面

使用Navigation.PushAsync()方法

Button StackLayoutDemo1Button = new Button();

StackLayoutDemo1Button.Clicked += ((sender,e)=>

{

Navigation.PushAsync(new StackLayoutExample());

});

StackLayoutDemo1Button.Text = "StackLayout+Label"; //內容 Content = new StackLayout { //間距 Spacing = 10, Children = { StackLayoutDemo1Button } };

返回上一頁

使用Navigation.PopAsync()方法

var backButton = new Button();

backButton.Text = "返回";

backButton.Clicked += ((sender,e) => { Navigation.PopAsync(); }); //內容 Content = new StackLayout { Spacing = 10, Children = { backButton } };

示例代碼

Modal Navigation

A NavigationPage instance is not required for performing modal page navigation.

執行Modal Navigation不需要NavigationPage的實例

跳轉頁面

使用Navigation.PushModalAsync()方法

StackLayoutDemo1Button.Text = "StackLayout+Label";

Button StackLayoutDemo1Button2 = new Button();

StackLayoutDemo1Button2.Clicked += ((sender,e)=> {

Navigation.PushModalAsync(new ListViewInStackLayout()); }); StackLayoutDemo1Button2.Text = "StackLayout+ListView"; //內容 Content = new StackLayout { //間距 Spacing = 10, Children = { StackLayoutDemo1Button2 } };

返回上一頁

使用Navigation.PopModalAsync()方法

var backButton = new Button();

backButton.Text = "返回";

backButton.Clicked += ((sender, e) => { Navigation.PopModalAsync(); }); Content = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { backButton } };

示例代碼

總結

以上是生活随笔為你收集整理的xamarin跳转html,Xamarin 页面跳转的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。