右对齐Xamarin入口

时间:2019-02-21 15:50:33

标签: c# xaml

我目前正在使用xamarin入口控件。它位于网格中,条目的大小非常完美。它会扩展并填充整个网格单元。我剩下的唯一问题是显示值的位置。在开始显示的那一刻,如何在保持大小的同时使其显示在右侧。

enter image description here

我当前的代码

<Grid Grid.Row="3">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
   <Label Grid.Row="0"
          Grid.Column="0"
          Text="{ Binding MobileMinPrice }"
          FontSize="14"
          HorizontalTextAlignment="Start"
          VerticalTextAlignment="Center"/>
    <Entry Margin="15,0,0,0"
           Placeholder="Min price"
           VerticalOptions="Center"
           Keyboard="Numeric"
           Text="{ Binding MinPriceStr, Mode=TwoWay }"
           HorizontalOptions="FillAndExpand"
           HorizontalTextAlignment="End">
     </Entry>
</Grid>

1 个答案:

答案 0 :(得分:0)

添加ScrollView。例如,像这样:

<ScrollView Orientation= "Horizontal">
<Grid Grid.Row="3">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </grid.ColumnDefinitions>
   <Label Grid.Row="0"
          Grid.Column="0"
          Text="{ Binding MobileMinPrice }"
          FontSize="14"
          HorizontalTextAlignment="Start"
          VerticalTextAlignment="Center"/>
    <Entry Margin="15,0,0,0"
           Placeholder="Min price"
           VerticalOptions="Center"
           Keyboard="Numeric"
           Text="{ Binding MinPriceStr, Mode=TwoWay }"
           HorizontalOptions="FillAndExpand"
           HorizontalTextAlignment="End">
     </Entry>
</Grid>
<ScrollView/>