From 8e6c98f647af3c9f5a9c01dfff6ce1b2c06ee967 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:59:18 +0900 Subject: [PATCH] Fix showOpenWithMenu --- src/Files.App/Helpers/ShellContextMenuHelper.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Files.App/Helpers/ShellContextMenuHelper.cs b/src/Files.App/Helpers/ShellContextMenuHelper.cs index 9770c9378f78..1ec0a4726593 100644 --- a/src/Files.App/Helpers/ShellContextMenuHelper.cs +++ b/src/Files.App/Helpers/ShellContextMenuHelper.cs @@ -252,11 +252,15 @@ public static async Task LoadShellMenuItems(string path, CommandBarFlyout itemCo if (showOpenWithMenu) { - var openWithItem = shellMenuItems.Where(x => (x.Tag as Win32ContextMenuItem)?.ID == 100).ToList().FirstOrDefault(); - var (_, openWithItems) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(new List() { openWithItem }); - itemContextMenuFlyout.SecondaryCommands.Insert(0, openWithItems.FirstOrDefault()); + var openWithItem = shellMenuItems.Where(x => (x.Tag as Win32ContextMenuItem)?.CommandString == "openas").ToList().FirstOrDefault(); + if (openWithItem is not null) + { + var (_, openWithItems) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(new List() { openWithItem }); + itemContextMenuFlyout.SecondaryCommands.Insert(0, openWithItems.FirstOrDefault()); + shellMenuItems.Remove(openWithItem); + } } - + if (!UserSettingsService.PreferencesSettingsService.MoveShellExtensionsToSubMenu) { var (_, secondaryElements) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(shellMenuItems);