Im getting the error "Sequence contains no elements" in a simple xaml form. I am fairly new to Xamarin forms so please bear with me.
Any thoughts?
<?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>
Always make sure ContentPage.Content has only one layout control like StackLayout or Grid etc and all other controls inside them.
<ContentPage.Content>
<StackLayout>
<!-- all controls go here -->
</StackLayout>
</ContentPage.Content>
That will fix the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With