Updating the QueryText to the selected item when navigating up/down with the arrow keys.

This commit is contained in:
ryanbodrug-microsoft 2020-04-25 09:37:20 -07:00
parent aa79325d76
commit 9d3720557e

View File

@ -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;