Add support for PageUp & PageDown

This commit is contained in:
Yeechan Lu 2014-03-17 03:52:52 +08:00
parent 94ed77353e
commit 798faff7b2
2 changed files with 34 additions and 0 deletions

View File

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

View File

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