summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r--Xamarin.Forms.Platform.WinRT/Platform.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/Platform.cs b/Xamarin.Forms.Platform.WinRT/Platform.cs
index 6c158a05..311186b2 100644
--- a/Xamarin.Forms.Platform.WinRT/Platform.cs
+++ b/Xamarin.Forms.Platform.WinRT/Platform.cs
@@ -13,7 +13,9 @@ using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
#if WINDOWS_UWP
+using Windows.Foundation;
using Windows.Foundation.Metadata;
+using Windows.UI.Core;
using Windows.UI.ViewManagement;
#endif
@@ -591,6 +593,17 @@ namespace Xamarin.Forms.Platform.WinRT
options.SetResult((string)e.ClickedItem);
};
+ TypedEventHandler<CoreWindow, CharacterReceivedEventArgs> onEscapeButtonPressed = delegate(CoreWindow window, CharacterReceivedEventArgs args)
+ {
+ if (args.KeyCode == 27)
+ {
+ dialog.Hide();
+ options.SetResult(ContentDialogResult.None.ToString());
+ }
+ };
+
+ Window.Current.CoreWindow.CharacterReceived += onEscapeButtonPressed;
+
_actionSheetOptions = options;
if (options.Cancel != null)
@@ -604,6 +617,8 @@ namespace Xamarin.Forms.Platform.WinRT
options.SetResult(options.Cancel);
else if (result == ContentDialogResult.Primary)
options.SetResult(options.Destruction);
+
+ Window.Current.CoreWindow.CharacterReceived -= onEscapeButtonPressed;
}
#else
void OnPageActionSheet(Page sender, ActionSheetArguments options)