Skip to content

Commit 0965661

Browse files
authored
Code Quality: Added workaround for open with icon to display correctly (#14962)
1 parent 39c2f9c commit 0965661

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

src/Files.App/Actions/FileSystem/OpenItemAction.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ public string Label
6262
public string Description
6363
=> "OpenItemWithApplicationPickerDescription".GetLocalizedResource();
6464

65-
// TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
66-
//public RichGlyph Glyph
67-
// => new(opacityStyle: "ColorIconOpenWith");
65+
public RichGlyph Glyph
66+
=> new(opacityStyle: "ColorIconOpenWith");
6867

6968
public bool IsExecutable =>
7069
context.HasSelection &&

src/Files.App/Data/Factories/ContentPageContextFlyoutFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
378378
}.Build(),
379379
new ContextMenuFlyoutItemViewModel()
380380
{
381-
Text = "OpenWith".GetLocalizedResource(),
382-
// TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
381+
// TODO add back text and icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
382+
//Text = "OpenWith".GetLocalizedResource(),
383383
//OpacityIcon = new OpacityIconModel()
384384
//{
385385
// OpacityIconStyle = "ColorIconOpenWith"

src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,10 @@ x.Tag is Win32ContextMenuItem menuItem &&
336336
{
337337
await openWithItem.LoadSubMenuAction();
338338

339-
// TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
340-
//openWithItem.OpacityIcon = new OpacityIconModel()
341-
//{
342-
// OpacityIconStyle = "ColorIconOpenWith",
343-
//};
339+
openWithItem.OpacityIcon = new OpacityIconModel()
340+
{
341+
OpacityIconStyle = "ColorIconOpenWith",
342+
};
344343
var (_, openWithItems) = ContextFlyoutModelToElementHelper.GetAppBarItemsFromModel(new List<ContextMenuFlyoutItemViewModel>() { openWithItem });
345344
var placeholder = itemContextMenuFlyout.SecondaryCommands.Where(x => Equals((x as AppBarButton)?.Tag, "OpenWithPlaceholder")).FirstOrDefault() as AppBarButton;
346345
if (placeholder is not null)

src/Files.App/Files.App.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<PackageReference Include="SevenZipSharp" Version="1.0.2" />
8989
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
9090
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240311000" />
91-
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.1.1" />
91+
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.2.0" />
9292
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" PrivateAssets="all" />
9393
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
9494
<PackageReference Include="CommunityToolkit.WinUI.UI.Behaviors" Version="7.1.2" />

src/Files.App/Views/Layouts/BaseLayoutPage.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,13 @@ private async Task AddShellMenuItemsAsync(List<ContextMenuFlyoutItemViewModel> s
864864
openWithOverflow.Flyout = flyout;
865865
openWith.Visibility = Visibility.Collapsed;
866866
openWithOverflow.Visibility = Visibility.Visible;
867+
868+
// TODO delete this when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
869+
openWithOverflow.Content = new OpacityIconModel()
870+
{
871+
OpacityIconStyle = "ColorIconOpenWith"
872+
}.ToOpacityIcon();
873+
openWithOverflow.Label = "OpenWith".GetLocalizedResource();
867874
}
868875
}
869876

0 commit comments

Comments
 (0)