mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-05 04:39:08 +08:00
[Peek]Add up/down arrow key item navigation (#26644)
This commit is contained in:
parent
c69c74a8ad
commit
40ef76a686
@ -16,8 +16,10 @@
|
||||
</Window.SystemBackdrop>
|
||||
<Grid KeyboardAcceleratorPlacementMode="Hidden">
|
||||
<Grid.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="Left" Invoked="LeftNavigationInvoked" />
|
||||
<KeyboardAccelerator Key="Right" Invoked="RightNavigationInvoked" />
|
||||
<KeyboardAccelerator Key="Left" Invoked="PreviousNavigationInvoked" />
|
||||
<KeyboardAccelerator Key="Up" Invoked="PreviousNavigationInvoked" />
|
||||
<KeyboardAccelerator Key="Right" Invoked="NextNavigationInvoked" />
|
||||
<KeyboardAccelerator Key="Down" Invoked="NextNavigationInvoked" />
|
||||
<KeyboardAccelerator Key="Escape" Invoked="EscKeyInvoked" />
|
||||
</Grid.KeyboardAccelerators>
|
||||
|
||||
|
@ -94,14 +94,14 @@ namespace Peek.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void LeftNavigationInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
||||
private void PreviousNavigationInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
||||
{
|
||||
ViewModel.AttemptLeftNavigation();
|
||||
ViewModel.AttemptPreviousNavigation();
|
||||
}
|
||||
|
||||
private void RightNavigationInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
||||
private void NextNavigationInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
||||
{
|
||||
ViewModel.AttemptRightNavigation();
|
||||
ViewModel.AttemptNextNavigation();
|
||||
}
|
||||
|
||||
private void EscKeyInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
||||
|
@ -66,7 +66,7 @@ namespace Peek.UI
|
||||
Items = null;
|
||||
}
|
||||
|
||||
public void AttemptLeftNavigation()
|
||||
public void AttemptPreviousNavigation()
|
||||
{
|
||||
if (NavigationThrottleTimer.IsEnabled)
|
||||
{
|
||||
@ -80,7 +80,7 @@ namespace Peek.UI
|
||||
CurrentItem = Items?.ElementAtOrDefault(CurrentIndex);
|
||||
}
|
||||
|
||||
public void AttemptRightNavigation()
|
||||
public void AttemptNextNavigation()
|
||||
{
|
||||
if (NavigationThrottleTimer.IsEnabled)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user