From c16cd4c96f3c8591669373a7c4653af461924290 Mon Sep 17 00:00:00 2001 From: Michael Jolley Date: Mon, 28 Jul 2025 18:26:32 -0500 Subject: [PATCH] Fixed issue with primary/secondary commands (#40849) Closes #40822 These are not the classes you are looking for. Issue was we were comparing to classes rather than interfaces and WinRT no likey. --- .../Microsoft.CmdPal.Core.ViewModels/CommandItemViewModel.cs | 2 +- .../Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/CommandItemViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/CommandItemViewModel.cs index 247814e5e6..1861b53ef7 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/CommandItemViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/CommandItemViewModel.cs @@ -342,7 +342,7 @@ public partial class CommandItemViewModel : ExtensionObjectViewModel, ICommandBa var newContextMenu = more .Select(item => { - if (item is CommandContextItem contextItem) + if (item is ICommandContextItem contextItem) { return new CommandContextItemViewModel(contextItem, PageContext) as IContextItemViewModel; } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs index a6bd2bb302..7787916de5 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs @@ -113,7 +113,7 @@ public abstract partial class ContentPageViewModel : PageViewModel, ICommandBarC .ToList() .Select(item => { - if (item is CommandContextItem contextItem) + if (item is ICommandContextItem contextItem) { return new CommandContextItemViewModel(contextItem, PageContext); } @@ -172,7 +172,7 @@ public abstract partial class ContentPageViewModel : PageViewModel, ICommandBarC .ToList() .Select(item => { - if (item is CommandContextItem contextItem) + if (item is ICommandContextItem contextItem) { return new CommandContextItemViewModel(contextItem, PageContext) as IContextItemViewModel; }