简体   繁体   中英

I am wroking Xamarin.forms and getting this error in xaml file

错误:属性“内容”设置了多次

I tried remove one child layout but didn't worked.

Inside a Page , you can only have one layout element. Inside that layout element, you can have infinite nested elements.

So, everything you have now should be wrapped in a StackLayout, Grid, or similar according to your needs.

Like this:

<ContentPage> 
    <StackLayout>
        <!-- Your current layout -->
    </StackLayout>
</ContentPage>

You need ContentPage.Content

<?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:behaviors="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
             x:Class="WowonderPhone.Pages.WelcomePage">
    <ContentPage.Content>
        <StackLayout>
            <!-- Place Content Here -->
            <Label Text="Hello World"/>
            <Label Text="Hello World"/>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

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