summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.MacOS/Extensions/NSButtonExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Extensions/NSButtonExtensions.cs')
-rw-r--r--Xamarin.Forms.Platform.MacOS/Extensions/NSButtonExtensions.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Extensions/NSButtonExtensions.cs b/Xamarin.Forms.Platform.MacOS/Extensions/NSButtonExtensions.cs
new file mode 100644
index 0000000..d37f1a3
--- /dev/null
+++ b/Xamarin.Forms.Platform.MacOS/Extensions/NSButtonExtensions.cs
@@ -0,0 +1,25 @@
+´╗┐using System;
+using AppKit;
+
+namespace Xamarin.Forms.Platform.MacOS
+{
+ public static class NSButtonExtensions
+ {
+ public static NSButton CreateButton(string text, Action activate = null)
+ {
+ return CreateButton(text, null, activate);
+ }
+
+ public static NSButton CreateButton(string text, NSImage image = null, Action activate = null)
+ {
+ var btn = new NSButton { Title = text };
+ btn.BezelStyle = NSBezelStyle.TexturedRounded;
+
+ if (image != null)
+ btn.Image = image;
+ if (activate != null)
+ btn.Activated += (sender, e) => activate();
+ return btn;
+ }
+ }
+} \ No newline at end of file