Xamarin 财产';内容';设置了多次-XAML

Xamarin 财产';内容';设置了多次-XAML,xamarin,Xamarin,每次我尝试在主页中实现时,都会显示“属性'Content'设置了不止一次”。每次我把这个地方给我'属性'内容'设置了不止一次' 如果有人能简单地解释一下Content属性的设置位置,那将是非常有帮助的 <ContentPage xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps" xmlns="http://xamar

每次我尝试在主页中实现
时,都会显示“属性'Content'设置了不止一次”。每次我把这个地方给我'属性'内容'设置了不止一次'

如果有人能简单地解释一下Content属性的设置位置,那将是非常有帮助的

<ContentPage xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d" 
             x:Class="Pap.MainPage">

    <maps:Map IsShowingUser="True" x:Name="Mapa" />

    <AbsoluteLayout VerticalOptions="FillAndExpand" x:Name="Main">
        
        <StackLayout AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" x:Name="main" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
            <Image Source="C:\Users\david\Desktop\Pap\Pap\Pap.Android\Resources\drawable\User.png" Aspect="AspectFill" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Image>

        </StackLayout>
        <StackLayout x:Name="body" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All"
   Orientation="Vertical" VerticalOptions="FillAndExpand" Spacing="0">
            <!--<StackLayout VerticalOptions="End" BackgroundColor="Red">
    <Label Text="Titulo" />
    
   </StackLayout>-->
            <StackLayout VerticalOptions="FillAndExpand">
                <Label Text="Slider-Example"  HorizontalOptions="Center" VerticalOptions="Center"/>
                <Image Source="C:\Users\david\Desktop\Pap\Pap\Pap.Android\Resources\drawable\User.png" Aspect="AspectFill"></Image>
                <StackLayout.GestureRecognizers>
                    <TapGestureRecognizer Tapped="Handle_Tapped">
                    </TapGestureRecognizer>
                </StackLayout.GestureRecognizers>
            </StackLayout>
        </StackLayout>
    </AbsoluteLayout>

</ContentPage>

ContentPage
有一个隐式的
Content
属性,可以包含一个子元素。如果要在页面上包含多个内容,则需要使用容器,如
StackLayout

<ContentPage ... >
  <StackLayout>
    ... multiple children can go here
  </StackLayout>
</ContentPage>
myPage.Content = new StackLayout{ ... };