summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/Button.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core/Button.cs')
-rw-r--r--Xamarin.Forms.Core/Button.cs21
1 files changed, 15 insertions, 6 deletions
diff --git a/Xamarin.Forms.Core/Button.cs b/Xamarin.Forms.Core/Button.cs
index 97d774c9..bcd593ed 100644
--- a/Xamarin.Forms.Core/Button.cs
+++ b/Xamarin.Forms.Core/Button.cs
@@ -116,13 +116,18 @@ namespace Xamarin.Forms
void IButtonController.SendClicked()
{
- ICommand cmd = Command;
- if (cmd != null)
- cmd.Execute(CommandParameter);
+ Command?.Execute(CommandParameter);
+ Clicked?.Invoke(this, EventArgs.Empty);
+ }
- EventHandler handler = Clicked;
- if (handler != null)
- handler(this, EventArgs.Empty);
+ void IButtonController.SendPressed()
+ {
+ Pressed?.Invoke(this, EventArgs.Empty);
+ }
+
+ void IButtonController.SendReleased()
+ {
+ Released?.Invoke(this, EventArgs.Empty);
}
public FontAttributes FontAttributes
@@ -146,6 +151,10 @@ namespace Xamarin.Forms
public event EventHandler Clicked;
+ public event EventHandler Pressed;
+
+ public event EventHandler Released;
+
public Button()
{
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Button>>(() => new PlatformConfigurationRegistry<Button>(this));