Skip to content

Commit

Permalink
Popup aligment (#12491)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeotero authored and QilongTang committed Jan 20, 2022
1 parent f09fdd8 commit 63cbd7b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/DynamoCoreWpf/Views/GuidedTour/PopupWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
Expand All @@ -19,6 +20,8 @@ public partial class PopupWindow : Popup
private bool isClosingTour;

private const string packagesTourName = "packages";
//Field that indicates wheter popups are left-aligned or right-aligned
private const string menuDropAligment = "_menuDropAlignment";

internal WebBrowserWindow webBrowserWindow;

Expand Down Expand Up @@ -55,7 +58,19 @@ public PopupWindow(PopupWindowViewModel viewModel, HostControlInfo hInfo)
Opened += PopupWindow_Opened;
Closed += PopupWindow_Closed;

isClosingTour = false;
isClosingTour = false;

EnsureStandardPopupAlignment();
}

private void EnsureStandardPopupAlignment()
{
var menuDropAlignmentField = typeof(SystemParameters).GetField(menuDropAligment, BindingFlags.NonPublic | BindingFlags.Static);
if (SystemParameters.MenuDropAlignment && menuDropAlignmentField != null)
{
//Sets field to false and ignores the alignment
menuDropAlignmentField.SetValue(null, false);
}
}

private void PopupWindow_Closed(object sender, EventArgs e)
Expand Down

0 comments on commit 63cbd7b

Please sign in to comment.