WPF Popup位置偏移
在开发WPF时,Popup遇到个奇怪问题。我的机器设置的布局是好好的,在某台平板电脑上就不正常。


为什么两台电脑不一样的效果呢?系统也是win10, 或者说都是windows。百度不好找, 上google看了一翻:
http://www.cnblogs.com/tommy-huang/p/5105758.html
这个作者提供了解决方案。果然,小白经验少。
////// popup会识别左撇子、右撇子
///private static void SetAlignment() {
//获取系统是以Left-handed(true)还是Right-handed(false)
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);
}
}