mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
CmdPal: Replace FiltersDropDown ComboBox with searchable dropdown (#45747)
## Summary of the Pull Request Replaces the ComboBox-based filter control with a DropDownButton and Flyout containing a searchable TextBox and ListView. - Add type-to-search: typing while button is focused opens the flyout and filters items by name - Designed to match appearance of the context menu - Add keyboard navigation: `Up`/`Down `moves selection from search box, `Enter` confirms, `Escape` clears search text (or closes if empty), `F4` opens the dropdown - Add `Alt+F` shortcut on ShellPage to toggle filter focus - Style flyout to match ContextMenu (item padding, separators, search box appearance) - Show "No results" empty state when search matches nothing - After confirming selection, return focus to the main search box - Add accessibility - Update `FilterTemplateSelector` to support both ComboBoxItem and ListViewItem containers - Guard against infinite loop in navigation when only separators exist ## Pictures? Moving! https://github.com/user-attachments/assets/60e232ae-8cee-4759-a9a7-d7edbf78719e <img width="315" height="212" alt="image" src="https://github.com/user-attachments/assets/b6e1a895-064c-47e1-9184-26dbb46fdf05" /> <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: #41648 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.UI.Input;
|
||||
using Windows.System;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace Microsoft.CmdPal.UI.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Snapshot of the current keyboard modifier state (Ctrl, Alt, Shift, Win).
|
||||
/// </summary>
|
||||
internal readonly struct KeyModifiers
|
||||
{
|
||||
public bool Ctrl { get; }
|
||||
|
||||
public bool Alt { get; }
|
||||
|
||||
public bool Shift { get; }
|
||||
|
||||
public bool Win { get; }
|
||||
|
||||
private KeyModifiers(bool ctrl, bool alt, bool shift, bool win)
|
||||
{
|
||||
Ctrl = ctrl;
|
||||
Alt = alt;
|
||||
Shift = shift;
|
||||
Win = win;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a snapshot of the modifier keys currently held down.
|
||||
/// </summary>
|
||||
public static KeyModifiers GetCurrent()
|
||||
{
|
||||
var ctrl = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
|
||||
var alt = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down);
|
||||
var shift = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
|
||||
var win = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.LeftWindows).HasFlag(CoreVirtualKeyStates.Down) ||
|
||||
InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.RightWindows).HasFlag(CoreVirtualKeyStates.Down);
|
||||
return new KeyModifiers(ctrl, alt, shift, win);
|
||||
}
|
||||
|
||||
public bool OnlyAlt => Alt && !Ctrl && !Shift && !Win;
|
||||
|
||||
public bool OnlyCtrl => Ctrl && !Alt && !Shift && !Win;
|
||||
|
||||
public bool None => !Ctrl && !Alt && !Shift && !Win;
|
||||
}
|
||||
Reference in New Issue
Block a user