From 9d3720557eb5889ca53f3260f4e61f06479aeb77 Mon Sep 17 00:00:00 2001 From: ryanbodrug-microsoft <56318517+ryanbodrug-microsoft@users.noreply.github.com> Date: Sat, 25 Apr 2020 09:37:20 -0700 Subject: [PATCH] Updating the QueryText to the selected item when navigating up/down with the arrow keys. --- .../launcher/PowerLauncher/MainWindow.xaml.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs index d6eb508f33..1f794b4055 100644 --- a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs @@ -239,21 +239,25 @@ namespace PowerLauncher if (e.Key == VirtualKey.Tab && IsKeyDown(VirtualKey.Shift)) { _viewModel.SelectPrevTabItemCommand.Execute(null); + UpdateTextBoxToSelectedItem(); e.Handled = true; } else if (e.Key == VirtualKey.Tab) { - _viewModel.SelectNextTabItemCommand.Execute(null); + _viewModel.SelectNextTabItemCommand.Execute(null); + UpdateTextBoxToSelectedItem(); e.Handled = true; } else if (e.Key == VirtualKey.Down) { _viewModel.SelectNextItemCommand.Execute(null); + UpdateTextBoxToSelectedItem(); e.Handled = true; } else if (e.Key == VirtualKey.Up) { _viewModel.SelectPrevItemCommand.Execute(null); + UpdateTextBoxToSelectedItem(); e.Handled = true; } else if (e.Key == VirtualKey.PageDown) @@ -268,6 +272,15 @@ namespace PowerLauncher } } + private void UpdateTextBoxToSelectedItem() + { + var itemText = _viewModel?.Results?.SelectedItem?.ToString() ?? null; + if (!String.IsNullOrEmpty(itemText)) + { + _viewModel.ChangeQueryText(itemText); + } + } + private void SuggestionsList_Tapped(object sender, TappedRoutedEventArgs e) { var result = ((Windows.UI.Xaml.FrameworkElement)e.OriginalSource).DataContext;