30 lines
861 B
C#
30 lines
861 B
C#
using Android.Content;
|
|
using Android.Graphics.Drawables;
|
|
using Gallery.Droid.Renderers;
|
|
using Gallery.UI;
|
|
using Xamarin.Forms;
|
|
using Xamarin.Forms.Platform.Android;
|
|
|
|
[assembly: ExportRenderer(typeof(OptionPicker), typeof(OptionPickerRenderer))]
|
|
namespace Gallery.Droid.Renderers
|
|
{
|
|
public class OptionPickerRenderer : PickerRenderer
|
|
{
|
|
public OptionPickerRenderer(Context context) : base(context)
|
|
{
|
|
}
|
|
|
|
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
|
|
{
|
|
base.OnElementChanged(e);
|
|
|
|
if (e.NewElement != null)
|
|
{
|
|
var drawable = new ColorDrawable(e.NewElement.BackgroundColor.ToAndroid());
|
|
Control.Gravity = Android.Views.GravityFlags.Right;
|
|
Control.SetBackground(drawable);
|
|
}
|
|
}
|
|
}
|
|
}
|