为什么自Windows10(1809/1903)以来,我所有的WPF应用程序都无法拖动到其窗口之外,例如调整窗口大小或进行拖放?

为什么自Windows10(1809/1903)以来,我所有的WPF应用程序都无法拖动到其窗口之外,例如调整窗口大小或进行拖放?,wpf,windows-10,Wpf,Windows 10,有一天,我发现我所有的WPF应用程序都无法拖出窗口,我无法通过实时预览调整任何窗口的大小 我的问题是为什么会发生这种情况,我该如何解决 您可以查看动画图像,如下所示: 您可以注意到,当我的光标位于窗口外时,调整大小立即停止,并且窗口保持光标第一次离开窗口时的大小。如果光标重新进入窗口区域,窗口大小将继续调整 不仅我编写的所有WPF应用程序,而且其他WPF应用程序都复制了: Visual Studio 2017/2019 窥探 屏风 等等 非WPF应用程序的行为正常 这个现象发生在几个月

有一天,我发现我所有的WPF应用程序都无法拖出窗口,我无法通过实时预览调整任何窗口的大小

我的问题是为什么会发生这种情况,我该如何解决


您可以查看动画图像,如下所示:

您可以注意到,当我的光标位于窗口外时,调整大小立即停止,并且窗口保持光标第一次离开窗口时的大小。如果光标重新进入窗口区域,窗口大小将继续调整

不仅我编写的所有WPF应用程序,而且其他WPF应用程序都复制了:

  • Visual Studio 2017/2019
  • 窥探
  • 屏风
  • 等等
非WPF应用程序的行为正常

这个现象发生在几个月前,因为我的系统版本是Windows10(1809),现在我的系统版本是Windows10(1903),这个问题仍然存在。从.NET Framework 3.5/4.5/4.8和.NET Core 3.0嵌入的WPF应用程序


更新1:我刚刚清理了所有驱动器,并用一些核心应用程序重新安装了Windows 10 Professional(1903,客户版),问题仍然存在。核心应用是Chrome、PalmInput、IME和iTunes


Update2:我已经编写了一个WPF应用程序来处理窗口消息。我发现当我在其外部调整窗口大小时,
49757
消息将停止接收。消息在我朋友的系统上正常运行。

更新:

WPF团队成员建议在WPF中禁用手写笔和触摸支持的方法是使用
App.config
中的
Switch.System.Windows.Input.stylus.DisableStylusAndTouchSupport
设置,如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <AppContextSwitchOverrides value="Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport=true" />
  </runtime>  
</configuration>

非常感谢您提供这样的解决方案。它可能有助于许多小型演示WPF应用程序,但对工程WPF软件影响很大。因此,这是一个正确的解决方案,但不是一个合适的解决方案。再次感谢你给我的帮助。好消息!由于insider preview 10.0.18975.1000,此问题已修复。这意味着它将在下一版本的Windows10(19H2)中修复。
public static void DisableWpfTabletSupport()
{
    // Get a collection of the tablet devices for this window.    
    TabletDeviceCollection devices = System.Windows.Input.Tablet.TabletDevices;


    if (devices.Count > 0)
    {
        // Get the Type of InputManager.  
        Type inputManagerType = typeof(System.Windows.Input.InputManager);


        // Call the StylusLogic method on the InputManager.Current instance.  
        object stylusLogic = inputManagerType.InvokeMember("StylusLogic",
                    BindingFlags.GetProperty | BindingFlags.Instance | 
                    BindingFlags.NonPublic,
                    null, InputManager.Current, null);


        if (stylusLogic != null)
        {
            // Get the type of the stylusLogic returned 
            // from the call to StylusLogic.  
            Type stylusLogicType = stylusLogic.GetType();


            // Loop until there are no more devices to remove.  
            while (devices.Count > 0)
            {
                // Remove the first tablet device in the devices collection.  
                stylusLogicType.InvokeMember("OnTabletRemoved",
                        BindingFlags.InvokeMethod | 
                        BindingFlags.Instance | BindingFlags.NonPublic,
                        null, stylusLogic, new object[] { (uint)0 });
            }
        }
    }
}