This repository was archived by the owner on May 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Xamarin.Forms.Platform.MacOS/Renderers Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ namespace Xamarin.Forms.Platform.MacOS
88{
99 public class ButtonRenderer : ViewRenderer < Button , NSButton >
1010 {
11+ const float DefaultCornerRadius = 6 ;
12+
1113 class FormsNSButton : NSButton
1214 {
1315 class FormsNSButtonCell : NSButtonCell
@@ -94,7 +96,7 @@ protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
9496 {
9597 var btn = new FormsNSButton ( ) ;
9698 btn . SetButtonType ( NSButtonType . MomentaryPushIn ) ;
97- btn . BezelStyle = NSBezelStyle . Rounded ;
99+ btn . BezelStyle = NSBezelStyle . RoundRect ;
98100 btn . Pressed += HandleButtonPressed ;
99101 btn . Released += HandleButtonReleased ;
100102 SetNativeControl ( btn ) ;
@@ -155,7 +157,7 @@ void UpdateBorder()
155157 uiButton . Layer . BorderColor = button . BorderColor . ToCGColor ( ) ;
156158
157159 uiButton . Layer . BorderWidth = ( float ) button . BorderWidth ;
158- uiButton . Layer . CornerRadius = button . CornerRadius ;
160+ uiButton . Layer . CornerRadius = button . CornerRadius > 0 ? button . CornerRadius : DefaultCornerRadius ;
159161
160162 UpdateBackgroundVisibility ( ) ;
161163 }
@@ -214,6 +216,5 @@ void HandleButtonReleased()
214216 {
215217 Element ? . SendReleased ( ) ;
216218 }
217-
218219 }
219220}
You can’t perform that action at this time.
0 commit comments