Files
PowerToys/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ItemsUpdatedEventArgs.cs

16 lines
441 B
C#
Raw Normal View History

CmdPal: Lightning-fast mode (#45764) ## Summary of the Pull Request This PR unlocks lightning-fast mode for Command Palette: - Hides visual and motion distractions when updating the result list: - Ensures the first interactable result item is selected as early as possible after the result list is updated, reducing flashing and blinking caused by the selection highlight moving around. - Removes the list item selection indicator animation (unfortunately by removing the pill altogether for now) and prevents it from temporarily appearing on other items as the selection moves. - Adds a new "Results" section header above the home page results when no other section is present. - This ensures the first item on the home page has consistent visuals and styling, preventing offsets and excessive visual changes when elements are replaced in place. - Improves update performance and container reuse: - Fixes the `removed` output parameter in `ListHelper.UpdateInPlace` to only include items that were actually removed (items that were merely moved to a different position should not be reported as removed). - Adds unit tests to prevent regression. - Updates `ListHelper.UpdateInPlace` for `ObservableCollection` to use `Move` instead of `Remove`/`Add`, and avoids `Clear` to prevent `ListView` resets (which force recreation of all item containers and are expensive). - Adds a simple cache for list page item view models to reduce unnecessary recreation during forward incremental search. - `ListViewModel` and `FetchItems` have no notion of item lifetime or incremental search phase, so the cache intentionally remains simple rather than clever. - Updates ListPage templates to make them a little lighter: - Tag template uses OneTime, instead of OneWay - since Tag is immutable - Replaces ItemsControl with ItemsRepeater for Tag list on list items - Increases the debounce for showing the details pane and adds a debounce for hiding it. This improves performance when browsing the list and prevents the details pane animation from bouncing left and right ## Pictures? Moving! https://github.com/user-attachments/assets/36428d20-cf46-4321-83c0-d94d6d4a2299 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: #44407 - [x] Closes: #45691
2026-02-26 13:17:34 +01:00
// 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.
namespace Microsoft.CmdPal.UI.ViewModels;
CmdPal: Lightning-fast mode (#45764) ## Summary of the Pull Request This PR unlocks lightning-fast mode for Command Palette: - Hides visual and motion distractions when updating the result list: - Ensures the first interactable result item is selected as early as possible after the result list is updated, reducing flashing and blinking caused by the selection highlight moving around. - Removes the list item selection indicator animation (unfortunately by removing the pill altogether for now) and prevents it from temporarily appearing on other items as the selection moves. - Adds a new "Results" section header above the home page results when no other section is present. - This ensures the first item on the home page has consistent visuals and styling, preventing offsets and excessive visual changes when elements are replaced in place. - Improves update performance and container reuse: - Fixes the `removed` output parameter in `ListHelper.UpdateInPlace` to only include items that were actually removed (items that were merely moved to a different position should not be reported as removed). - Adds unit tests to prevent regression. - Updates `ListHelper.UpdateInPlace` for `ObservableCollection` to use `Move` instead of `Remove`/`Add`, and avoids `Clear` to prevent `ListView` resets (which force recreation of all item containers and are expensive). - Adds a simple cache for list page item view models to reduce unnecessary recreation during forward incremental search. - `ListViewModel` and `FetchItems` have no notion of item lifetime or incremental search phase, so the cache intentionally remains simple rather than clever. - Updates ListPage templates to make them a little lighter: - Tag template uses OneTime, instead of OneWay - since Tag is immutable - Replaces ItemsControl with ItemsRepeater for Tag list on list items - Increases the debounce for showing the details pane and adds a debounce for hiding it. This improves performance when browsing the list and prevents the details pane animation from bouncing left and right ## Pictures? Moving! https://github.com/user-attachments/assets/36428d20-cf46-4321-83c0-d94d6d4a2299 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: #44407 - [x] Closes: #45691
2026-02-26 13:17:34 +01:00
public sealed partial class ItemsUpdatedEventArgs : EventArgs
{
public bool ForceFirstItem { get; }
public ItemsUpdatedEventArgs(bool forceFirstItem)
{
ForceFirstItem = forceFirstItem;
}
}