Add the list item requested shortcuts back (#38573)

* [x] Re-adds the context menu shortcut text
* [x] Hooks up the keybindings to the search box so that you can just press the keys while you have an item selected, and do a context command
* [x] Hook these keybindings up to the context flyout itself
* [x] Adds a sample for testing

Solves #38271
This commit is contained in:
Mike Griese
2025-04-17 06:13:11 -05:00
committed by GitHub
parent 6cf73ce839
commit 05218e8af6
14 changed files with 243 additions and 9 deletions

View File

@@ -2,14 +2,19 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Windows.Foundation;
using Windows.System;
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public partial class KeyChordHelpers
{
public static KeyChord FromModifiers(bool ctrl, bool alt, bool shift, bool win, int vkey, int scanCode)
public static KeyChord FromModifiers(
bool ctrl = false,
bool alt = false,
bool shift = false,
bool win = false,
int vkey = 0,
int scanCode = 0)
{
var modifiers = (ctrl ? VirtualKeyModifiers.Control : VirtualKeyModifiers.None)
| (alt ? VirtualKeyModifiers.Menu : VirtualKeyModifiers.None)
@@ -18,4 +23,15 @@ public partial class KeyChordHelpers
;
return new(modifiers, vkey, scanCode);
}
public static KeyChord FromModifiers(
bool ctrl = false,
bool alt = false,
bool shift = false,
bool win = false,
VirtualKey vkey = VirtualKey.None,
int scanCode = 0)
{
return FromModifiers(ctrl, alt, shift, win, (int)vkey, scanCode);
}
}