From 4554e822e3cf5ae71724a8fc89d1a8728118f060 Mon Sep 17 00:00:00 2001 From: Andrei N Date: Sun, 9 Oct 2016 10:52:38 +0300 Subject: Added CornerRadius property To Frame control --- Xamarin.Forms.Platform.WP8/FrameRenderer.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Xamarin.Forms.Platform.WP8/FrameRenderer.cs') diff --git a/Xamarin.Forms.Platform.WP8/FrameRenderer.cs b/Xamarin.Forms.Platform.WP8/FrameRenderer.cs index 00472161..2149033b 100644 --- a/Xamarin.Forms.Platform.WP8/FrameRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/FrameRenderer.cs @@ -19,6 +19,7 @@ namespace Xamarin.Forms.Platform.WinPhone PackChild(); UpdateBorder(); + UpdateCornerRadius(); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) @@ -29,6 +30,8 @@ namespace Xamarin.Forms.Platform.WinPhone PackChild(); else if (e.PropertyName == Frame.OutlineColorProperty.PropertyName || e.PropertyName == Frame.HasShadowProperty.PropertyName) UpdateBorder(); + else if (e.PropertyName == Frame.CornerRadiusProperty.PropertyName) + UpdateCornerRadius(); } void PackChild() @@ -44,7 +47,6 @@ namespace Xamarin.Forms.Platform.WinPhone void UpdateBorder() { - Control.CornerRadius = new CornerRadius(5); if (Element.OutlineColor != Color.Default) { Control.BorderBrush = Element.OutlineColor.ToBrush(); @@ -53,5 +55,15 @@ namespace Xamarin.Forms.Platform.WinPhone else Control.BorderBrush = new Color(0, 0, 0, 0).ToBrush(); } + + void UpdateCornerRadius() + { + float cornerRadius = Element.CornerRadius; + + if (cornerRadius == -1f) + cornerRadius = 5f; // default corner radius + + Control.CornerRadius = new CornerRadius(cornerRadius); + } } } \ No newline at end of file -- cgit v1.2.3