不能在xaml中多次设置内容

不能在xaml中多次设置内容,xaml,xamarin,xamarin.forms,xamarin.android,Xaml,Xamarin,Xamarin.forms,Xamarin.android,我正在使用Xamarin和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:d="http://xamarin

我正在使用Xamarin和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:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:telerikDataControls="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
xmlns:telerikListView="clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.XamarinForms.DataControls"
              xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input" 
              xmlns:vm="clr-namespace:WMS.ViewModels"

             x:Class="Views.HomePage">
    <ContentPage.Content>

        <ScrollView>
            <Frame x:Name="reprint" Padding="40" IsClippedToBounds="False"   CornerRadius="4">
                <telerikPrimitives:RadBorder BorderThickness="8" CornerRadius="10">

                    <StackLayout>

                        <Label Text=" Label"></Label>
                        <Label Text="Allows the User to reprint a label."></Label>

                        <telerikInput:RadButton BackgroundColor="#343C41" TextColor="White" Text="Label Reprint" x:Name="btnLabelReprint" Clicked="BtnLabelReprint_Clicked">

                        </telerikInput:RadButton>
                    </StackLayout>

                </telerikPrimitives:RadBorder>




            </Frame>
            <Frame x:Name="warehouseTransferr" Padding="40"    CornerRadius="4">
                <telerikPrimitives:RadBorder BorderThickness="8" CornerRadius="10">

                    <StackLayout>

                        <Label Text="Ware House Transfer"></Label>
                        <Label Text="Allows users to transfer from warehouse to waehouse"></Label>

                    <telerikInput:RadButton BackgroundColor="#343C41" TextColor="White" Text="Warehouse Transfer" x:Name="btnWarehouseTransfe" Clicked="BtnWarehouseTransfe_Clicked">

                            </telerikInput:RadButton>
                    </StackLayout>

                </telerikPrimitives:RadBorder>




            </Frame>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>

严重性代码说明项目文件行抑制状态 错误XLS0501属性“Content”设置了多次。HomePage.xaml 36


一个ScrollView不能有多个子视图,因此多次定义内容时会出现错误

因此,要解决此问题,您可以将内容封装在StackLayout中:

  <ScrollView>
    <StackLayout>
            <Frame x:Name="reprint" Padding="40" IsClippedToBounds="False"   CornerRadius="4">
                <telerikPrimitives:RadBorder BorderThickness="8" CornerRadius="10">

                    <StackLayout>

                        <Label Text=" Label"></Label>
                        <Label Text="Allows the User to reprint a label."></Label>

                        <telerikInput:RadButton BackgroundColor="#343C41" TextColor="White" Text="Label Reprint" x:Name="btnLabelReprint" Clicked="BtnLabelReprint_Clicked">

                        </telerikInput:RadButton>
                    </StackLayout>

                </telerikPrimitives:RadBorder>
            </Frame>
            <Frame x:Name="warehouseTransferr" Padding="40"    CornerRadius="4">
                <telerikPrimitives:RadBorder BorderThickness="8" CornerRadius="10">

                    <StackLayout>

                        <Label Text="Ware House Transfer"></Label>
                        <Label Text="Allows users to transfer from warehouse to waehouse"></Label>

                    <telerikInput:RadButton BackgroundColor="#343C41" TextColor="White" Text="Warehouse Transfer" x:Name="btnWarehouseTransfe" Clicked="BtnWarehouseTransfe_Clicked">

                            </telerikInput:RadButton>
                    </StackLayout>

                </telerikPrimitives:RadBorder>
            </Frame>
        </StackLayout>
    </ScrollView>

一个ScrollView不能有多个子视图,因此多次定义内容时会出现错误

因此,要解决此问题,您可以将内容封装在StackLayout中:

  <ScrollView>
    <StackLayout>
            <Frame x:Name="reprint" Padding="40" IsClippedToBounds="False"   CornerRadius="4">
                <telerikPrimitives:RadBorder BorderThickness="8" CornerRadius="10">

                    <StackLayout>

                        <Label Text=" Label"></Label>
                        <Label Text="Allows the User to reprint a label."></Label>

                        <telerikInput:RadButton BackgroundColor="#343C41" TextColor="White" Text="Label Reprint" x:Name="btnLabelReprint" Clicked="BtnLabelReprint_Clicked">

                        </telerikInput:RadButton>
                    </StackLayout>

                </telerikPrimitives:RadBorder>
            </Frame>
            <Frame x:Name="warehouseTransferr" Padding="40"    CornerRadius="4">
                <telerikPrimitives:RadBorder BorderThickness="8" CornerRadius="10">

                    <StackLayout>

                        <Label Text="Ware House Transfer"></Label>
                        <Label Text="Allows users to transfer from warehouse to waehouse"></Label>

                    <telerikInput:RadButton BackgroundColor="#343C41" TextColor="White" Text="Warehouse Transfer" x:Name="btnWarehouseTransfe" Clicked="BtnWarehouseTransfe_Clicked">

                            </telerikInput:RadButton>
                    </StackLayout>

                </telerikPrimitives:RadBorder>
            </Frame>
        </StackLayout>
    </ScrollView>


只需要第二双眼睛,我想我可能已经错过了一堆感谢表单,从旧时代开始已经走过了很长一段路,但有些错误消息没有那么有用。事实上,这个消息有点通用。但很高兴我能帮上忙:)只需要第二双眼睛,我想我可能错过了一堆感谢表格从旧时代以来已经走过了很长的一段路,但有些错误信息没有那么有用。事实上,这个信息有点泛化。但很高兴我能帮忙:)