我有一个 WPF 桌面应用程序。我收到 W8 用户的报告,称我们应用程序中的代码完成窗口未正确对齐。我调查发现它是W8平板电脑设置中的一个设置与wpf中弹出窗口的位置冲突
Default is right handed and then the code completion popup looks like this
When changed to left handed the code completion popup renders correctly like this
有没有办法以编程方式强制应用程序使用左手设置,或者完全忽略它,以便它像 w7 一样呈现?
编辑:得到了一个 upwote,因此可以使用解决方案进行更新,需要 .NET 4.5
private static readonly FieldInfo MenuDropAlignmentField;
static MyWindow()
{
MenuDropAlignmentField = typeof (SystemParameters).GetField("_menuDropAlignment",
BindingFlags.NonPublic | BindingFlags.Static);
System.Diagnostics.Debug.Assert(MenuDropAlignmentField != null);
EnsureStandardPopupAlignment();
SystemParameters.StaticPropertyChanged += (s, e) => EnsureStandardPopupAlignment();
}
private static void EnsureStandardPopupAlignment()
{
if (SystemParameters.MenuDropAlignment && MenuDropAlignmentField != null)
{
MenuDropAlignmentField.SetValue(null, false);
}
}
完整代码在这里
https://github.com/AndersMalmgren/FreePIE/blob/master/FreePIE.GUI/Shells/MainShellView.xaml.cs https://github.com/AndersMalmgren/FreePIE/blob/master/FreePIE.GUI/Shells/MainShellView.xaml.cs
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)