【发布时间】:2017-11-21 18:32:28
【问题描述】:
我以简单的 xaml 形式收到错误“序列不包含元素”。 我对 Xamarin 表单还很陌生,所以请多多包涵。
有什么想法吗?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CRM.Views.CustomerItem" Title="Customer Info">
<ContentPage.Content>
<StackLayout Padding="10" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="Name" Grid.Row="0" Grid.Column="0" HorizontalOptions="Start" VerticalOptions="Center"></Label>
<Entry Text="{Binding CustName}" Grid.Row="0" Grid.Column="1"/>
<Label Text="Surname" Grid.Row="1" Grid.Column="0" HorizontalOptions="Start" VerticalOptions="Center"></Label>
<Entry Text="{Binding CustSurname}" Grid.Row="1" Grid.Column="1"/>
<Label Text="Address" Grid.Row="2" Grid.Column="0" HorizontalOptions="Start" VerticalOptions="Center"></Label>
<Entry Text="{Binding Address}" Grid.Row="2" Grid.Column="1"/>
<Label Text="PhoneNumber" Grid.Row="3" Grid.Column="0" HorizontalOptions="Start" VerticalOptions="Center"></Label>
<Entry Text="{Binding PhoneNumber}" Grid.Row="3" Grid.Column="1"/>
</Grid>
</StackLayout>
<Button Text="Save" HorizontalOptions="FillAndExpand" BackgroundColor="Blue" TextColor="White" Clicked="Save_Clicked"></Button>
<Button Text="Cancel" HorizontalOptions="FillAndExpand" BackgroundColor="Red" TextColor="White" Clicked="Cancel_Clicked"></Button>
</ContentPage.Content>
【问题讨论】:
-
您的按钮不包含在任何布局中,并且您的网格没有定义任何行
标签: c# xaml xamarin mobile xamarin.forms