Skip to content

Commit

Permalink
DYN-4304-ContextMenu-Direction (#13624)
Browse files Browse the repository at this point in the history
When showing the NotificationsCenter popup and the Windows10 Handedness is Right-handed then the popup was shown in the wrong location then I implemented a fix that will be setting temporally the field _menuDropAlignment (this one modifies the Handedness) so in this way if the Handedness is Right-handed we will be setting this to Left-handed and the popup will be displayed in the right direction.
  • Loading branch information
RobertGlobant20 authored Dec 10, 2022
1 parent f1452d6 commit a62d402
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Notifications/View/NotificationUI.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using System.Reflection;
using System.Windows;
using System.Windows.Controls.Primitives;

namespace Dynamo.Notifications.View
Expand All @@ -19,6 +20,15 @@ public NotificationUI()
notificationsUIViewModel = new NotificationsUIViewModel();
}

//When if the Windows Handedness parameter is set to Right-handed (True) then we need to set the _menuDropAlignment field to false otherwise the Notifications popup will be shown in a wrong Position
var ifLeft = SystemParameters.MenuDropAlignment;
if (ifLeft) //If MenuDropAlignment = Right-handed(True)
{
var t = typeof(SystemParameters);
var field = t.GetField("_menuDropAlignment", BindingFlags.NonPublic | BindingFlags.Static);
field.SetValue(null, false); //Set the field to Left-handed(false)
}

DataContext = notificationsUIViewModel;

//The BackgroundRectangle represent the tooltip background rectangle that is drawn over a Canvas
Expand Down

0 comments on commit a62d402

Please sign in to comment.