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
8
8
{
9
9
public class ButtonRenderer : ViewRenderer < Button , NSButton >
10
10
{
11
+ const float DefaultCornerRadius = 6 ;
12
+
11
13
class FormsNSButton : NSButton
12
14
{
13
15
class FormsNSButtonCell : NSButtonCell
@@ -94,7 +96,7 @@ protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
94
96
{
95
97
var btn = new FormsNSButton ( ) ;
96
98
btn . SetButtonType ( NSButtonType . MomentaryPushIn ) ;
97
- btn . BezelStyle = NSBezelStyle . Rounded ;
99
+ btn . BezelStyle = NSBezelStyle . RoundRect ;
98
100
btn . Pressed += HandleButtonPressed ;
99
101
btn . Released += HandleButtonReleased ;
100
102
SetNativeControl ( btn ) ;
@@ -155,7 +157,7 @@ void UpdateBorder()
155
157
uiButton . Layer . BorderColor = button . BorderColor . ToCGColor ( ) ;
156
158
157
159
uiButton . Layer . BorderWidth = ( float ) button . BorderWidth ;
158
- uiButton . Layer . CornerRadius = button . CornerRadius ;
160
+ uiButton . Layer . CornerRadius = button . CornerRadius > 0 ? button . CornerRadius : DefaultCornerRadius ;
159
161
160
162
UpdateBackgroundVisibility ( ) ;
161
163
}
@@ -214,6 +216,5 @@ void HandleButtonReleased()
214
216
{
215
217
Element ? . SendReleased ( ) ;
216
218
}
217
-
218
219
}
219
220
}
You can’t perform that action at this time.
0 commit comments