Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button text always showing in uppercase

In my xamarin forms project button text are always show in uppercase format.
But I am providing upper and lower case letters in xaml. When I build the solution all the letters are changed to uppercase.

like image 439
Sreejith Sree Avatar asked Nov 29 '17 04:11

Sreejith Sree


2 Answers

I'm guessing you see this on Android as it is the default for button text and has been since Lollipop.

To change this behavior add the following to your styles.xml file which can be found in the Android project under the Resources then values folders

<item name="android:textAllCaps">false</item> 
like image 78
Steve Chadbourne Avatar answered Sep 28 '22 02:09

Steve Chadbourne


An alternative is to simply use TextTransform property:

<Button Text="Click Me" TextTransform="None"/> 

Or in a style definition:

<Style TargetType="Button" x:Key="NoDefaultCapsButton">      <Setter Property="TextTransform" Value="None"/> </Style>  <Button Text="Click Me" Style="{x:StaticResource NoDefaultCapsButton}"/> 

Important Note

Be sure you are using Xamarin.Forms NuGet package 4.8.0.1534 or above, if TextTransform is not showing for you than clean and rebuild your solution.

like image 27
Cfun Avatar answered Sep 28 '22 02:09

Cfun