From 798faff7b28255a08fac4c163ecd13f4f7dbb983 Mon Sep 17 00:00:00 2001 From: Yeechan Lu Date: Mon, 17 Mar 2014 03:52:52 +0800 Subject: [PATCH] Add support for PageUp & PageDown --- Wox/MainWindow.xaml.cs | 12 ++++++++++++ Wox/ResultPanel.xaml.cs | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index f0cfdb5916..e268f2b1d8 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -315,6 +315,18 @@ namespace Wox e.Handled = true; break; + case Key.PageDown: + resultCtrl.SelectNextPage(); + toolTip.IsOpen = false; + e.Handled = true; + break; + + case Key.PageUp: + resultCtrl.SelectPrevPage(); + toolTip.IsOpen = false; + e.Handled = true; + break; + case Key.Enter: AcceptSelect(resultCtrl.AcceptSelect()); e.Handled = true; diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultPanel.xaml.cs index 8ae0cf370b..273e003d0e 100644 --- a/Wox/ResultPanel.xaml.cs +++ b/Wox/ResultPanel.xaml.cs @@ -162,5 +162,27 @@ namespace Wox OnOnMouseClickItem(item.DataContext as Result); } } + + public void SelectNextPage() + { + int index = lbResults.SelectedIndex; + index += 5; + if (index >= lbResults.Items.Count) + { + index = lbResults.Items.Count - 1; + } + Select(index); + } + + public void SelectPrevPage() + { + int index = lbResults.SelectedIndex; + index -= 5; + if (index < 0) + { + index = 0; + } + Select(index); + } } } \ No newline at end of file