Search code examples
xamarintabstabbedpage

Why xaml tabbed page attribute local is not working in this case?


I have a very simple xaml code but attribute local:Page simply doesn't work, when I type "local" it gets underlined as if there is an error.

MainPage.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"
             xmlns:local="clr-namespace:Solution;assembly=Solution"
             x:Class="Solution.MainPage">

    <local:Listar Title="XXXX" />

</TabbedPage>

Listar.xaml:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:Solution;assembly=Solution"
             x:Class="Solution.Listar">
    <ContentPage.Content>
        <StackLayout>
            <Label Text="Welcome to Xamarin.Forms!"
                VerticalOptions="CenterAndExpand" 
                HorizontalOptions="CenterAndExpand" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

Solution

  • TabbedPage must contain child pages.

    <TabbedPage.Children>
    
            <local:Listar Title="XXX"/>
    
    </TabbedPage.Children>