Pixiview/Gallery.Android/Renderers/OptionEntryRenderer.cs
2021-08-04 10:27:41 +08:00

29 lines
787 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(OptionEntry), typeof(OptionEntryRenderer))]
namespace Gallery.Droid.Renderers
{
public class OptionEntryRenderer : EntryRenderer
{
public OptionEntryRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
var drawable = new ColorDrawable(e.NewElement.BackgroundColor.ToAndroid());
Control.SetBackground(drawable);
}
}
}
}