From 0134823de18939672434f100b093ca4fbdafa9a6 Mon Sep 17 00:00:00 2001 From: Yu Leng <42196638+moooyo@users.noreply.github.com> Date: Fri, 27 Jun 2025 10:08:46 +0800 Subject: [PATCH] [cmdpal] Fix primary button doesn't work issue (#40243) ## Summary of the Pull Request ok... it seems didn't work since 0.91. Maybe we forgot to send message when command has more commands? ## PR Checklist - [ ] **Closes:** #xxx - [ ] **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 ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed Co-authored-by: Yu Leng --- .../cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandBarViewModel.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandBarViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandBarViewModel.cs index fff845b0a9..6fcd738e4e 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandBarViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandBarViewModel.cs @@ -155,6 +155,7 @@ public partial class CommandBarViewModel : ObservableObject, ContextMenuStack.Add(new ContextMenuStackViewModel(command)); OnPropertyChanging(nameof(ContextMenu)); OnPropertyChanged(nameof(ContextMenu)); + WeakReferenceMessenger.Default.Send(new(command.Command.Model, command.Model)); return ContextKeybindingResult.KeepOpen; } else