Xamarin.forms: Add Picker.TextAlignment

Created on 1 Aug 2019  Â·  7Comments  Â·  Source: xamarin/Xamarin.Forms

Summary

Picker shows text but there's no way to control its alignment.

API Changes

var picker = new Picker();
picker.HorizontalTextAlignment = TextAlignment.Center;

Intended Use Case

Modifying how a picker looks.

F100 help wanted in-progress inactive proposal-accepted enhancement âž• up-for-grabs

Most helpful comment

@pictos Sure!

All 7 comments

I'd love to have this too.

@samhouts, Can I work on this?

@pictos Sure!

Hi @pictos ,
Have you already started working on TextAlignment implementation?
Cause I have HTA and VTA for ios and Android for picker and can make pull request for it.

Yeah @yurkinh I already started the implementation. But no problem. After your PR merges I can add the implementation to another platforms.

Updated to Xamarin.Forms 4.8

image

I've tried horizontal text alignment as follow :
<Picker x:Name="picker" Grid.Row="6" HorizontalTextAlignment="Center" Title="Select a monkey" TitleColor="Red"> <Picker.ItemsSource> <x:Array Type="{x:Type x:String}"> <x:String>Baboon</x:String> <x:String>Capuchin Monkey</x:String> <x:String>Blue Monkey</x:String> <x:String>Squirrel Monkey</x:String> <x:String>Golden Lion Tamarin</x:String> <x:String>Howler Monkey</x:String> <x:String>Japanese Macaque</x:String> </x:Array> </Picker.ItemsSource> </Picker>
but I get this error , look likes it's not able to find the property

image

Works great for me thanks picker.HorizontalTextAlignment = TextAlignment.Center;

Was this page helpful?
0 / 5 - 0 ratings