2017-08-01 42 views
-1

我試圖在內容頁面內添加TappedPage,因此它沒有顯示任何UI。 我也試圖找到解決方案,但我得到了我們不能把TappedPage內ContentPage TappedPage視圖應該是父視圖。如何在Xamarin表單中添加ContentPage中的TabbedPage

There is two tab inside a contentPage i want to replace it with TappedPage

,但我也有這樣的要求補充您好,我試圖添加TappedPage內容頁裏面所以它沒有顯示任何UI。 我也試圖找到解決辦法,但我得到的,我們不能把TappedPage ContentPage TappedPage視圖中應該是父視圖

,但我有這樣的要求,在地方的最近和所有附加TappedPage。如果螞蟻有任何想法,請讓我更新。

+0

請發佈 –

回答

0

很難理解你的問題。我沒有一個好的英語,我認爲不理解你的問題。

順便說一句,不可能將TabbedPage添加到ContentPage。您必須將ContentPage添加到TabbedPage。

對於實施例(來自Xamarin文檔)

public class MainPageCS : TabbedPage { public MainPageCS() { 
    var navigationPage = new NavigationPage (new SchedulePageCS()); 
    navigationPage.Icon = "schedule.png"; 
    navigationPage.Title = "Schedule"; 

    Children.Add (new TodayPageCS()); 
    Children.Add (navigationPage); } } 

的TabbedPage填充有兩個子頁對象。第一個孩子是一個ContentPage實例,第二個標籤是一個包含ContentPage實例的NavigationPage。

0

如果您正在使用XAML這可能是你的一個有用的例子:

<?xml version="1.0" encoding="utf-8" ?> 
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" 
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
      prism:ViewModelLocator.AutowireViewModel="True" 
      xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms" 
      xmlns:me="clr-namespace:TabPages;assembly=TabPages" 
      x:Class="YourApp.YourPage" BarBackgroundColor="#FF0000"> 
    <ContentPage Title="Tab 1"> 
     <StackLayout Padding="4"> 
      <!-- Content of the first tab --> 
     </StackLayout> 
    </ContentPage> 
    <ContentPage Title="Tab 2"> 
     <StackLayout Padding="4"> 
      <!-- Content of the second tab --> 
     </StackLayout> 
    </ContentPage> 
</TabbedPage> 
+0

由於之前曾經看過你自己的問題的回覆我想補充TabbedPage內ContentPage –

+0

你必須改變「 ContentPage「與」TappedPage「。 – TeoVr81

相關問題