private void OnGridViewItemClick(object sender, ItemClickEventArgs e) { if (e.ClickedItem is ITask && (!WinKeyboardHelper.IsKeyDown(VirtualKey.Control) && !WinKeyboardHelper.IsKeyDown(VirtualKey.Shift))) { var task = (ITask)e.ClickedItem; // hack to make sure we'll ignore the next 2 SelectionChanged event // we do this, because we don't want to open the action bar in that case this.ignoreSelectionChanges = 3; this.gridviewTasks.SelectedItems.Clear(); this.mainPage.HideContextualActionBar(); this.navigationService.FlyoutTo(ViewLocator.CreateEditTaskPageNew, task); } }
private static void OnTextboxKeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key == VirtualKey.Enter || e.Key == VirtualKey.Tab) { // Ctrl + Enter is a special keyboard shortcut, so it's ignored here if (WinKeyboardHelper.IsKeyDown(VirtualKey.Control)) { return; } var textbox = (TextBox)sender; Panel panel = TreeHelper.FindVisualAncestor <Panel>(textbox); if (panel == null) { throw new NotSupportedException("Could not find parent panel"); } // move the focus to the dummy button so that it hides the virtual keyboard var entry = PanelsCache[textbox]; entry.Button.Focus(FocusState.Keyboard); } }