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