[英]Navigating through pages in Xamarin without changing the entire content of the page
https://i.stack.imgur.com/TNKac.png
有沒有辦法在Xamarin.Forms中完成上述操作? 在UWP中,我可以通過使用Frame元素來做到這一點,並且可以在不更改整個內容的情況下瀏覽頁面。
我認為您可以使用MasterDetailPage 。 您有一個MasterPage(在左側)和DetailPage(在右側),您可以在按下Master中的項目時進行更改。
這是您可以在C#中創建MasterDetail的方法
public class MainPageCS : MasterDetailPage
{
MasterPageCS masterPage;
public MainPageCS ()
{
masterPage = new MasterPageCS ();
Master = masterPage;
Detail = new NavigationPage (new ContactsPageCS ());
}
}
MasterDetailPage.Master屬性設置為ContentPage實例。 MasterDetailPage.Detail屬性設置為包含ContentPage實例的NavigationPage。
否則,如果您不喜歡MasterDetail,則可以“簡單”使用2行X 2列的網格 。 然后,您可以將ContentView用於菜單(它應該使用Grid.SetRowsSpan (menuContentView, 2);
因此contentView填充2行。
然后,您可以將標簽用作標題,將另一個ContentView用於“頁面”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.