简体   繁体   中英

Xamarin Shell use Contentview inside ShellContent

I have the following code in my AppShell.xaml

<Shell ....
...
    <TabBar Shell.TabBarUnselectedColor="Green" Shell.BackgroundColor="Gray" Shell.NavBarHasShadow="True" Shell.NavBarIsVisible="False">
        <ShellContent Title="WebView" Icon="icon_about.png" Route="LoginView" >
            <local:LoginPage/>
        </ShellContent>

            <ShellContent Title="Listing" Icon="icon_about.png" Route="ListingView"  ContentTemplate="{DataTemplate local:ListingView}" />

...

Where LoginPage is / has to be a ContentView , because I need to display other Views inside of it.

But I can't figure out how to use a ContentView as ShellContent because every time i get a specified cast is not valid -exception. Is there any other way to use a ContentView inside ShellContent ?

Thanks in advance

A ShellContent object represents the ContentPage object for each FlyoutItem or Tab .

We can't set a ContentView inside ShellContent .

The only way is to place the LoginView into a ContentPage , and then use in ShellContent .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM