Skip to content

Commit

Permalink
[Android]Fix for frame renderer's bug (bugzilla 60787).
Browse files Browse the repository at this point in the history
  • Loading branch information
adambarath committed Sep 28, 2018
1 parent 2b8ea38 commit 51c8224
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Xamarin.Forms.Platform.Android/Renderers/FrameRenderer.cs
Expand Up @@ -48,10 +48,19 @@ protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
{
base.OnElementChanged(e);

if (e.OldElement != null)
{
e.OldElement.PropertyChanged -= Element_PropertyChanged;
}
if (e.NewElement != null)
{
e.NewElement.PropertyChanged += Element_PropertyChanged;
}


if (e.NewElement != null && e.OldElement == null)
{
UpdateBackground();
UpdateCornerRadius();
_motionEventHelper.UpdateElement(e.NewElement);
}
}
Expand All @@ -61,9 +70,9 @@ void UpdateBackground()
this.SetBackground(new FrameDrawable(Element, Context.ToPixels));
}

void UpdateCornerRadius()
void Element_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
this.SetBackground(new FrameDrawable(Element, Context.ToPixels));
UpdateBackground();
}

class FrameDrawable : Drawable
Expand Down

0 comments on commit 51c8224

Please sign in to comment.