diff --git a/src/Files.App/App.xaml b/src/Files.App/App.xaml
index b4bd7eff717d..67a7a905c4c3 100644
--- a/src/Files.App/App.xaml
+++ b/src/Files.App/App.xaml
@@ -33,6 +33,7 @@
+
diff --git a/src/Files.App/Helpers/MenuFlyout/ItemModelListToContextFlyoutHelper.cs b/src/Files.App/Helpers/MenuFlyout/ItemModelListToContextFlyoutHelper.cs
index f38caf27db30..b995edfade81 100644
--- a/src/Files.App/Helpers/MenuFlyout/ItemModelListToContextFlyoutHelper.cs
+++ b/src/Files.App/Helpers/MenuFlyout/ItemModelListToContextFlyoutHelper.cs
@@ -1,6 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.
+using Files.App.UserControls.Menus;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
@@ -86,6 +87,21 @@ private static MenuFlyoutItemBase GetMenuFlyoutItem(ContextMenuFlyoutItemViewMod
Text = item.Text,
Tag = item.Tag,
};
+
+ if (item.BitmapIcon is not null)
+ {
+ flyoutSubItem.Style = App.Current.Resources["MenuFlyoutSubItemWithImageStyle"] as Style;
+ flyoutSubItem.CornerRadius = new(4);
+ try
+ {
+ MenuFlyoutSubItemCustomProperties.SetBitmapIcon(flyoutSubItem, item.BitmapIcon);
+ }
+ catch (Exception e)
+ {
+ Debug.WriteLine(e);
+ }
+ }
+
item.Items.ForEach(i =>
{
flyoutSubItem.Items.Add(GetMenuItem(i));
@@ -109,6 +125,7 @@ private static MenuFlyoutItemBase GetItem(ContextMenuFlyoutItemViewModel i)
Tag = i.Tag,
Command = i.Command,
CommandParameter = i.CommandParameter,
+ CornerRadius = new(4),
};
try
{
diff --git a/src/Files.App/ResourceDictionaries/MenuFlyoutSubItemWithImageStyle.xaml b/src/Files.App/ResourceDictionaries/MenuFlyoutSubItemWithImageStyle.xaml
new file mode 100644
index 000000000000..4ab1c7d83bb3
--- /dev/null
+++ b/src/Files.App/ResourceDictionaries/MenuFlyoutSubItemWithImageStyle.xaml
@@ -0,0 +1,143 @@
+
+
+
+
+
diff --git a/src/Files.App/UserControls/Menus/MenuFlyoutSubItemCustomProperties.cs b/src/Files.App/UserControls/Menus/MenuFlyoutSubItemCustomProperties.cs
new file mode 100644
index 000000000000..3bdcbdbc81dd
--- /dev/null
+++ b/src/Files.App/UserControls/Menus/MenuFlyoutSubItemCustomProperties.cs
@@ -0,0 +1,31 @@
+// Copyright (c) 2023 Files Community
+// Licensed under the MIT License. See the LICENSE.
+
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Media.Imaging;
+
+namespace Files.App.UserControls.Menus
+{
+ [Microsoft.UI.Xaml.Data.Bindable]
+ public class MenuFlyoutSubItemCustomProperties : DependencyObject
+ {
+ public static readonly DependencyProperty BitmapIconProperty =
+ DependencyProperty.Register("BitmapIcon", typeof(BitmapImage), typeof(MenuFlyoutSubItemCustomProperties), new PropertyMetadata(null, OnBitmapIconChanged));
+
+ public static BitmapImage GetBitmapIcon(DependencyObject obj)
+ {
+ return (BitmapImage)obj.GetValue(BitmapIconProperty);
+ }
+
+ public static void SetBitmapIcon(DependencyObject obj, BitmapImage value)
+ {
+ obj.SetValue(BitmapIconProperty, value);
+ }
+
+ private static void OnBitmapIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ (d as MenuFlyoutSubItem).Icon = e.NewValue is not null ? new IconSourceElement() : null;
+ }
+ }
+}