Reputation: 135
I'm starting out with Xamarin.Forms and I'm trying to create the following Login/Password xaml form:
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label ClassId="lblUserID" Text="User ID: " FontAttributes="Bold" TextColor="Red"></Label>
<Entry ClassId="txtUserID" BackgroundColor="White" ></Entry>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label ClassId="lblPassword" Text="Password: " FontAttributes="Bold" TextColor="Red"></Label>
<Entry ClassId="txtPassword" BackgroundColor="White" ></Entry>
</StackLayout>
</StackLayout>
When I try to view the page in the Forms Previewer inside Visual Studio 2015, I'm noticing the entry controls are only showing a small width as opposed to my desired effect of showing on the rest of that row. I've tried tinkering around with WidthRequest and MinimumWdithRequest, but that doesn't seem to be the right property. Is there a special property that needs to be set in order for the entry controls to display full row (or at least as much of the row as possible)?
Thanks!
Upvotes: 2
Views: 1765
Reputation: 16199
You will need to set the HorizontalOptions to
HorizontalOptions="FillAndExpand"
This will cause the control to fill the remaining space on the screen.
Upvotes: 3