-
My code (unnecessary parts had been omitted): using Microsoft.UI.Xaml.Input;
using Windows.System;
// ...
KeyboardAccelerator _altLeftKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu);
// ...
KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null)
{
var keyboardAccelerator = new KeyboardAccelerator() { Key = key };
if (modifiers.HasValue)
{
keyboardAccelerator.Modifiers = modifiers.Value;
}
keyboardAccelerator.Invoked += OnKeyboardAcceleratorInvoked;
return keyboardAccelerator;
}
void OnKeyboardAcceleratorInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
{
var navigationService = App.GetService<INavigationService>();
var result = navigationService.GoBack();
args.Handled = result;
} It will cause
Actually, code above was generated by Microsoft/TemplateStudio and it worked well before. After I updated Windows App SDK (from 1.0) to 1.1.1, it threw the exception. Does anyone know why? It's just confusing! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@RayGicEFL Can I get you to try manually deleting your bin and obj folders of your app and then rebuilding and try again. Let me know if that helps or not. |
Beta Was this translation helpful? Give feedback.
-
However, the problem was solved by rebuilding project with Template Studio 5.1 (not 5.0). |
Beta Was this translation helpful? Give feedback.
However, the problem was solved by rebuilding project with Template Studio 5.1 (not 5.0).