Xamarin Forms多次设置了“ Content”属性

时间:2018-08-17 11:03:13

标签: xaml xamarin.forms

我在xamarin.forms项目中添加了ContentView xaml文件,但显示出令人讨厌的警告

  

“内容”属性设置了多次。

在我的ContentView.xaml文件下面

<ContentView
xmlns="http://xamarin.com/schemas/2014/forms" 
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
x:Class="XamarinTestList.View.AddContect">>
<StackLayout Spacing="12">
    <Entry x:Name="txtContactName" Text="{Binding Name}" HeightRequest="40" BackgroundColor="White" Placeholder="Contact Name" HorizontalOptions="FillAndExpand"/>
    <Entry  x:Name="txtMobileNumber" Keyboard="Telephone" Text="{Binding MobileNumber}" BackgroundColor="White" HeightRequest="40" Placeholder="Mobile Number" HorizontalOptions="FillAndExpand"/>
    <StackLayout Orientation="Horizontal">
        <Entry x:Name="txtAge" Text="{Binding Age}" HeightRequest="40" BackgroundColor="White" Placeholder="Age" HorizontalOptions="FillAndExpand"/>
        <Picker x:Name="GenderPicker" SelectedItem="{Binding Gender}" Title="Gender" BackgroundColor="White" HeightRequest="40" HorizontalOptions="FillAndExpand">
            <Picker.ItemsSource>
                <x:Array Type="{x:Type x:String}">
                    <x:String>Male</x:String>
                    <x:String>FeMale</x:String>
                </x:Array>
            </Picker.ItemsSource>
        </Picker>
    </StackLayout>
    <DatePicker x:Name="txtDOB" Date="{Binding DOB}" BackgroundColor="White" HeightRequest="40" HorizontalOptions="FillAndExpand"/>
    <Entry x:Name="txtAddress" Text="{Binding Address}" BackgroundColor="White"  HeightRequest="40" Placeholder="Address"  HorizontalOptions="FillAndExpand"/>
</StackLayout>
</ContentView>

警告屏幕截图:

enter image description here

1 个答案:

答案 0 :(得分:0)

也许是因为您的ContentView结尾处有两个“>”?