是否可以在主详细信息页面中添加选项卡页面?

时间:2018-01-03 04:05:04

标签: xamarin xamarin.forms master-detail tabbedpage

我需要制作如下图所示的内容。是否可以在详细信息页面中添加标签页? 每当我尝试时,我都会一直收到无效的施法错误。请帮忙 enter image description here

使用webview尝试此代码,但获得无效的强制转换异常

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:local="clr-namespace:Company.MobileApp.Custom"
            x:Class="Company.MobileApp.AboutPage">
    <Frame Padding="5"
           BackgroundColor="White"
           HasShadow="True"
           VerticalOptions="Center"
           HorizontalOptions="Center"
           OutlineColor="Black"
           HeightRequest="80"
           WidthRequest="1000"
           MinimumHeightRequest="40"
           MinimumWidthRequest="200">
        <StackLayout Padding="20,5,20,0">
            <Label Text="Energy Comsumption" Style="{StaticResource boldLabelCenter}" />

            <local:CustomPicker x:Name="ddlPremises" HeightRequest="40" />
        </StackLayout>
    </Frame>

    <!--Pages can be added as references or inline-->
    <ContentPage Title="Who is Company?">
        <StackLayout>
            <WebView Source="https://Company.com.sg/who/"
                     HeightRequest="1000"
                     WidthRequest="1000" />
        </StackLayout>
    </ContentPage>

    <ContentPage Title="How to Switch">
        <StackLayout>
            <WebView Source="https://Company.com.sg/how-to-Company/"
                     HeightRequest="1000"
                     WidthRequest="1000" />
        </StackLayout>
    </ContentPage>
</TabbedPage>

1 个答案:

答案 0 :(得分:0)

是的,有可能。这对我有用:

<MasterDetailPage.Master>
    <v:OneNavigationPage Title="MyTitle">
        <x:Arguments>
            <MyTabbedPage/>
        </x:Arguments>
    </v:OneNavigationPage>
</MasterDetailPage.Master>