verygolo
verygolo

Reputation: 95

Center text in Xamarin Entry

        <Entry Keyboard="Numeric" Text="{Binding QuantityString, Mode=TwoWay}" Grid.Row="1" Grid.ColumnSpan="3"
               VerticalOptions="Center" HorizontalOptions="Center" WidthRequest="50" HorizontalContentAlignment="Center">
          <Entry.Behaviors>
            <behaviors:NumericalValidationBehavior Minimum="{Binding MinQuantity}" Maximum="{Binding MaxQuantity}"/>
          </Entry.Behaviors>
        </Entry>

This is my Entry but the text isn't centered. I tried to add multiple alignment parameters.

It seems that I'm obliged to create my own Entry, Renderer, ... Is there anything more simple than this for just centering a text in Android Xamarin ?

Upvotes: 5

Views: 3788

Answers (1)

Tigerware
Tigerware

Reputation: 3924

It is pretty easy. Just set the property HorizontalTextAlignment="Center" like this:

<Entry 
   Text="{Binding Path=LionsValue}" 
   HorizontalTextAlignment="Center" />

Upvotes: 1

Related Questions