Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Date and time picker background color for Android

$
0
0

Hi I want to set background color of my time picker and date picker. I asked xamarin and they says I need to create a custom renderer. So I tried to create a custom renederer but I am not able to find the reference of TimePicker.. So far what I did is:

 [assembly: ExportRenderer(typeof(myTimePicker), typeof(MyTimePickerRenderer))]
    Namespace Demo
   {
        public class MyTimePickerRenderer :  ViewRenderer<myTimePicker, Android.Widget.TimePicker>
        {
             protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
             {
                  base.OnElementChanged(e);
                 if (Control != null)
                 {
                      Control.SetTextColor(global::Android.Graphics.Color.Black);

                    if (Control.Enabled)
                          Control.SetBackgroundColor(global::Android.Graphics.Color.WhiteSmoke);
                    else
                           Control.SetBackgroundColor(global::Android.Graphics.Color.LightCyan);
                 }
            }
      }

So any one knows how to do that?
Also provide the sample on iOS as well.... since I need to do the same on that platform as well.

Also I need DATEPICKER reference on android.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>