简体   繁体   English

Xamarin.Forms应用程序中的条目控件在StackLayout中不完整

[英]Entry control in Xamarin.Forms app not full length in StackLayout

I'm starting out with Xamarin.Forms and I'm trying to create the following Login/Password xaml form: 我从Xamarin.Forms开始,试图创建以下Login / Password xaml表单:

<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. 当我尝试在Visual Studio 2015内的窗体预览器中查看页面时,我注意到条目控件仅显示较小的宽度,而不是在该行的其余部分显示所需的效果。 I've tried tinkering around with WidthRequest and MinimumWdithRequest, but that doesn't seem to be the right property. 我尝试过修改WidthRequest和MinimumWdithRequest,但这似乎不是正确的属性。 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! 谢谢!

You will need to set the HorizontalOptions to 您将需要将Horizo​​ntalOptions设置为

HorizontalOptions="FillAndExpand"

This will cause the control to fill the remaining space on the screen. 这将导致控件填充屏幕上的剩余空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM