summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/AppCompat
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Android/AppCompat')
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs
index 3ca14eae..1092f767 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs
@@ -20,6 +20,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
readonly TapGestureHandler _tapGestureHandler;
float _defaultElevation = -1f;
+ float _defaultCornerRadius = -1f;
bool _clickable;
bool _disposed;
@@ -184,6 +185,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
e.NewElement.PropertyChanged += OnElementPropertyChanged;
UpdateShadow();
UpdateBackgroundColor();
+ UpdateCornerRadius();
SubscribeGestureRecognizers(e.NewElement);
}
}
@@ -215,6 +217,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
UpdateShadow();
else if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
UpdateBackgroundColor();
+ else if (e.PropertyName == Frame.CornerRadiusProperty.PropertyName)
+ UpdateCornerRadius();
}
void SubscribeGestureRecognizers(VisualElement element)
@@ -286,5 +290,22 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
else
CardElevation = 0f;
}
+
+ void UpdateCornerRadius()
+ {
+ if (_defaultCornerRadius == -1f)
+ {
+ _defaultCornerRadius = Radius;
+ }
+
+ float cornerRadius = Element.CornerRadius;
+
+ if (cornerRadius == -1f)
+ cornerRadius = _defaultCornerRadius;
+ else
+ cornerRadius = Context.ToPixels(cornerRadius);
+
+ Radius = cornerRadius;
+ }
}
} \ No newline at end of file