using Android.Content;
using Android.Graphics.Drawables;
using Billing.Droid.Renderers;
using Billing.UI;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(OptionDatePicker), typeof(OptionDatePickerRenderer))]
namespace Billing.Droid.Renderers
{
    public class OptionDatePickerRenderer : DatePickerRenderer
    {
        public OptionDatePickerRenderer(Context context) : base(context)
        {
        }

        protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                var drawable = new ColorDrawable(e.NewElement.BackgroundColor.ToAndroid());
                Control.SetBackground(drawable);
            }
        }
    }
}