diff --git a/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinRT.PopupMenu.cs b/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinRT.PopupMenu.cs index 2e1a6ff..883169c 100644 --- a/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinRT.PopupMenu.cs +++ b/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinRT.PopupMenu.cs @@ -10,7 +10,10 @@ public partial class TaskbarIcon [SupportedOSPlatform("windows5.1.2600")] private void ShowContextMenuInPopupMenuMode(System.Drawing.Point cursorPosition) { - var menu = new H.NotifyIcon.Core.PopupMenu(); + var menu = new H.NotifyIcon.Core.PopupMenu + { + RightToLeft = FlowDirection == FlowDirection.RightToLeft + }; #if HAS_MAUI PopulateMenu(menu.Items, (MenuFlyout)ContextFlyout); #else diff --git a/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinUI.SecondWindow.cs b/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinUI.SecondWindow.cs index 2167bc5..8682d46 100644 --- a/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinUI.SecondWindow.cs +++ b/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.WinUI.SecondWindow.cs @@ -1,4 +1,5 @@ using H.NotifyIcon.Interop; +using Microsoft.UI.Xaml.Data; namespace H.NotifyIcon; @@ -60,6 +61,15 @@ private void PrepareContextMenuWindow() { Background = new SolidColorBrush(Colors.Transparent), }; + + var flowDirectionBinding = new Binding + { + Source = this, + Path = new PropertyPath(nameof(FlowDirection)), + Mode = BindingMode.OneWay, + }; + BindingOperations.SetBinding(frame, FlowDirectionProperty, flowDirectionBinding); + var window = new Window() { Content = frame, diff --git a/src/libs/H.NotifyIcon/PopupMenus/PopupMenu.cs b/src/libs/H.NotifyIcon/PopupMenus/PopupMenu.cs index 3690cf0..2876894 100644 --- a/src/libs/H.NotifyIcon/PopupMenus/PopupMenu.cs +++ b/src/libs/H.NotifyIcon/PopupMenus/PopupMenu.cs @@ -16,6 +16,11 @@ public class PopupMenu /// public ICollection Items { get; } = new List(); + /// + /// + /// + public bool RightToLeft { get; set; } + /// /// /// @@ -30,6 +35,11 @@ public void Show(nint ownerHandle, int x, int y) TRACK_POPUP_MENU_FLAGS.TPM_NONOTIFY | TRACK_POPUP_MENU_FLAGS.TPM_BOTTOMALIGN; + if (RightToLeft) + { + flags |= TRACK_POPUP_MENU_FLAGS.TPM_LAYOUTRTL; + } + BOOL id; var lastId = 1;