diff options
author | Andrei N <nitescua@yahoo.com> | 2016-10-09 10:52:38 +0300 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-11-15 11:56:03 -0800 |
commit | 4554e822e3cf5ae71724a8fc89d1a8728118f060 (patch) | |
tree | f7befe212762dd6af5e4d8ae9c90a606c5ee7fc6 /Xamarin.Forms.Platform.Android/AppCompat | |
parent | 0cc2fd2b6742a29fedc03de942801cc14ff6b499 (diff) | |
download | xamarin-forms-4554e822e3cf5ae71724a8fc89d1a8728118f060.tar.gz xamarin-forms-4554e822e3cf5ae71724a8fc89d1a8728118f060.tar.bz2 xamarin-forms-4554e822e3cf5ae71724a8fc89d1a8728118f060.zip |
Added CornerRadius property To Frame control
Diffstat (limited to 'Xamarin.Forms.Platform.Android/AppCompat')
-rw-r--r-- | Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs | 21 |
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 |