Created
November 21, 2016 16:23
-
-
Save suchithm/46b02e7e17a06e92a1d5183730aa01d1 to your computer and use it in GitHub Desktop.
Frame Renderer class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Platform.Android; | |
using System.ComponentModel; | |
using Android.Graphics; | |
using Android.Graphics.Drawables; | |
using AButton = Android.Widget.Button; | |
using ACanvas = Android.Graphics.Canvas; | |
using GlobalResource = Android.Resource; | |
[assembly: ExportRenderer(typeof(RoundCornerFrame), typeof(RoundedCornerFrameRenderer))] | |
namespace FrameBugPoc.Droid | |
{ | |
public class RoundedCornerFrameRenderer : FrameRenderer | |
{ | |
protected override void OnElementChanged(ElementChangedEventArgs<Frame> e) | |
{ | |
base.OnElementChanged(e); | |
if (e.NewElement != null && e.OldElement == null) | |
{ | |
this.SetBackgroundResource(Resource.Drawable.rounded_corner_background); | |
GradientDrawable drawable = (GradientDrawable)this.Background; | |
drawable.SetColor(Android.Graphics.Color.ParseColor("#F0F0F0")); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment