WPF Menu displays to the left of the window

后端 未结 2 1260
被撕碎了的回忆
被撕碎了的回忆 2020-12-19 10:31

I have a simple Menu in a DockPanel. Here is the XAML:



        
2条回答
  •  轮回少年
    2020-12-19 10:54

    A fix that worked for me was:

            var ifLeft = SystemParameters.MenuDropAlignment;
            if (ifLeft)
            {
                // change to false
                var t = typeof(SystemParameters);
                var field = t.GetField("_menuDropAlignment", BindingFlags.NonPublic | BindingFlags.Static);
                field.SetValue(null, false);
                ifLeft = SystemParameters.MenuDropAlignment;
            }
    

    Credit: https://www.telerik.com/forums/popup-is-opening-to-outside-window-in-splitbutton

提交回复
热议问题