2021-08-04 10:27:41 +08:00

31 lines
820 B
C#

using Android.Content;
using Gallery.Droid.Renderers;
using Gallery.UI;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(BlurryPanel), typeof(BlurryPanelRenderer))]
namespace Gallery.Droid.Renderers
{
public class BlurryPanelRenderer : ViewRenderer
{
public BlurryPanelRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
var color = e.NewElement.BackgroundColor;
if (!color.IsDefault)
{
SetBackgroundColor(color.MultiplyAlpha(.94).ToAndroid());
}
}
}
}
}