日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

xamarin跳转html,Xamarin 页面跳转

發(fā)布時(shí)間:2023/12/20 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 xamarin跳转html,Xamarin 页面跳转 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

簡(jiǎn)介

Xamarin.Forms提供了許多不同的頁面導(dǎo)航體驗(yàn),具體取決于所使用的頁面類型

對(duì)于ContentPage實(shí)例,有兩種導(dǎo)航體驗(yàn):

Hierarchical Navigation

Modal Navigation

Hierarchical Navigation

NavigationPage類提供了一種分層導(dǎo)航體驗(yàn),用戶可以根據(jù)需要在頁面中進(jìn)行導(dǎo)航,向前和向后導(dǎo)航

該類實(shí)現(xiàn)導(dǎo)航作為Page對(duì)象的后進(jìn)先出(LIFO)堆棧

在分層導(dǎo)航中,NavigationPage類用于瀏覽一堆ContentPage對(duì)象

要從一個(gè)頁面移動(dòng)到另一個(gè)頁面,應(yīng)用程序會(huì)將新頁面推到導(dǎo)航堆棧上,在那里它將成為活動(dòng)頁面

要返回到上一頁面,應(yīng)用程序?qū)膶?dǎo)航堆棧中彈出當(dāng)前頁面,并且新的最頂端頁面將成為活動(dòng)頁面

根頁面設(shè)置為NavigationPage

添加到導(dǎo)航堆棧的第一個(gè)頁面被稱為應(yīng)用程序的根頁面

在App中修改起始頁的設(shè)置

MainPage = new NavigationPage(new MainPage());

跳轉(zhuǎn)頁面

使用Navigation.PushAsync()方法

Button StackLayoutDemo1Button = new Button();

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

{

Navigation.PushAsync(new StackLayoutExample());

});

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

返回上一頁

使用Navigation.PopAsync()方法

var backButton = new Button();

backButton.Text = "返回";

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

示例代碼

Modal Navigation

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

執(zhí)行Modal Navigation不需要NavigationPage的實(shí)例

跳轉(zhuǎn)頁面

使用Navigation.PushModalAsync()方法

StackLayoutDemo1Button.Text = "StackLayout+Label";

Button StackLayoutDemo1Button2 = new Button();

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

Navigation.PushModalAsync(new ListViewInStackLayout()); }); StackLayoutDemo1Button2.Text = "StackLayout+ListView"; //內(nèi)容 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 } };

示例代碼

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。