diff options
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs b/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs index acc41db3..aff11963 100644 --- a/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -8,7 +8,6 @@ using Xamarin.Forms.Internals; using WThickness = Windows.UI.Xaml.Thickness; using WButton = Windows.UI.Xaml.Controls.Button; using WImage = Windows.UI.Xaml.Controls.Image; -using Windows.UI.Xaml.Input; #if WINDOWS_UWP @@ -32,7 +31,6 @@ namespace Xamarin.Forms.Platform.WinRT { var button = new FormsButton(); button.Click += OnButtonClick; - button.AddHandler(PointerPressedEvent, new PointerEventHandler(OnPointerPressed), true); SetNativeControl(button); } @@ -101,16 +99,12 @@ namespace Xamarin.Forms.Platform.WinRT void OnButtonClick(object sender, RoutedEventArgs e) { - ((IButtonController)Element)?.SendReleased(); - ((IButtonController)Element)?.SendClicked(); + Button buttonView = Element; + if (buttonView != null) + ((IButtonController)buttonView).SendClicked(); } - void OnPointerPressed(object sender, RoutedEventArgs e) - { - ((IButtonController)Element)?.SendPressed(); - } - - void UpdateBackground() + void UpdateBackground() { Control.BackgroundColor = Element.BackgroundColor != Color.Default ? Element.BackgroundColor.ToBrush() : (Brush)Windows.UI.Xaml.Application.Current.Resources["ButtonBackgroundThemeBrush"]; } |