From 0965661a9367d22f32d4334b8a2bc81aaca63473 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Mon, 18 Mar 2024 23:39:01 +0900 Subject: [PATCH] Code Quality: Added workaround for open with icon to display correctly (#14962) --- src/Files.App/Actions/FileSystem/OpenItemAction.cs | 5 ++--- .../Data/Factories/ContentPageContextFlyoutFactory.cs | 4 ++-- src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs | 9 ++++----- src/Files.App/Files.App.csproj | 2 +- src/Files.App/Views/Layouts/BaseLayoutPage.cs | 7 +++++++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Files.App/Actions/FileSystem/OpenItemAction.cs b/src/Files.App/Actions/FileSystem/OpenItemAction.cs index 4f9cafa8ea30..2664b4cdaf74 100644 --- a/src/Files.App/Actions/FileSystem/OpenItemAction.cs +++ b/src/Files.App/Actions/FileSystem/OpenItemAction.cs @@ -62,9 +62,8 @@ public string Label public string Description => "OpenItemWithApplicationPickerDescription".GetLocalizedResource(); - // TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved - //public RichGlyph Glyph - // => new(opacityStyle: "ColorIconOpenWith"); + public RichGlyph Glyph + => new(opacityStyle: "ColorIconOpenWith"); public bool IsExecutable => context.HasSelection && diff --git a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs index c65d44bf60bf..96a1b12c09f7 100644 --- a/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs +++ b/src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs @@ -378,8 +378,8 @@ public static List GetBaseItemMenuItems( }.Build(), new ContextMenuFlyoutItemViewModel() { - Text = "OpenWith".GetLocalizedResource(), - // TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved + // TODO add back text and icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved + //Text = "OpenWith".GetLocalizedResource(), //OpacityIcon = new OpacityIconModel() //{ // OpacityIconStyle = "ColorIconOpenWith" diff --git a/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs b/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs index 26e80d16d426..1c158a14f0c4 100644 --- a/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs +++ b/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs @@ -336,11 +336,10 @@ x.Tag is Win32ContextMenuItem menuItem && { await openWithItem.LoadSubMenuAction(); - // TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved - //openWithItem.OpacityIcon = new OpacityIconModel() - //{ - // OpacityIconStyle = "ColorIconOpenWith", - //}; + openWithItem.OpacityIcon = new OpacityIconModel() + { + OpacityIconStyle = "ColorIconOpenWith", + }; var (_, openWithItems) = ContextFlyoutModelToElementHelper.GetAppBarItemsFromModel(new List() { openWithItem }); var placeholder = itemContextMenuFlyout.SecondaryCommands.Where(x => Equals((x as AppBarButton)?.Tag, "OpenWithPlaceholder")).FirstOrDefault() as AppBarButton; if (placeholder is not null) diff --git a/src/Files.App/Files.App.csproj b/src/Files.App/Files.App.csproj index c66f2866ff06..8e43a72a060b 100644 --- a/src/Files.App/Files.App.csproj +++ b/src/Files.App/Files.App.csproj @@ -88,7 +88,7 @@ - + diff --git a/src/Files.App/Views/Layouts/BaseLayoutPage.cs b/src/Files.App/Views/Layouts/BaseLayoutPage.cs index c7c4fd202445..094ab202261f 100644 --- a/src/Files.App/Views/Layouts/BaseLayoutPage.cs +++ b/src/Files.App/Views/Layouts/BaseLayoutPage.cs @@ -864,6 +864,13 @@ private async Task AddShellMenuItemsAsync(List s openWithOverflow.Flyout = flyout; openWith.Visibility = Visibility.Collapsed; openWithOverflow.Visibility = Visibility.Visible; + + // TODO delete this when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved + openWithOverflow.Content = new OpacityIconModel() + { + OpacityIconStyle = "ColorIconOpenWith" + }.ToOpacityIcon(); + openWithOverflow.Label = "OpenWith".GetLocalizedResource(); } }