Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Forms.DatePicker Text color

For Xamarin.Forms.DatePicker It is not obvious that the date field is "tapable" I want to change the text color of it to blue so the user will think it is clickable?

I see a background color property but not forecolor/text color?

Let me know how I can do that.

like image 899
Helen Araya Avatar asked Jun 12 '26 06:06

Helen Araya


1 Answers

I did it just creating a class like that on my Android Project and making no changes on my Forms Pages:

using Xamarin.Forms;

using xxxx.Droid;

[assembly: ExportRenderer(typeof(Xamarin.Forms.DatePicker), typeof(MyDatePickerRederer))]

namespace xxxx.Droid
{
   public class MyDatePickerRederer :    Xamarin.Forms.Platform.Android.DatePickerRenderer
   {
    protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.DatePicker> e)
    {
        base.OnElementChanged(e);

        this.Control.SetTextColor(Android.Graphics.Color.Black);
    }
   }
} 
like image 194
Alvaro Pereira Avatar answered Jun 17 '26 16:06

Alvaro Pereira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!