[Peek]Add up/down arrow key item navigation (#26644)

This commit is contained in:
Daniel Odrinski 2023-06-13 10:37:02 +01:00 committed by GitHub
parent c69c74a8ad
commit 40ef76a686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View File

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

View File

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

View File

@ -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)
{