On Windows 10 (1803), all applications lost touch or stylus if a WPF transparent window covers on them

后端 未结 1 854
既然无缘
既然无缘 2021-02-06 10:32

If I create a new WPF application with a simple empty window like the code shown below, I find that all applications which are covered by the WPF app lost touch or stylus reacti

相关标签:
1条回答
  • 2021-02-06 10:37

    Updated

    Microsoft has fixed this issue in .NET Framework August 2018 Preview of Quality Rollup.

    • August 30, 2018—KB4346783 (OS Build 17134.254)

    Addresses an issue where touch and mouse events were handled differently in Windows Presentation Foundation (WPF) applications that have a transparent overlay window.


    Original

    After a whole week's debugging, I finally find out the solution.

    Just add a ResizeMode="NoResize" property for the Window as the code shown below:

    <Window x:Class="TheWPFCoveringWindow.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            WindowStyle="None" WindowState="Maximized"
            AllowsTransparency="True" ResizeMode="NoResize"
            Background="Transparent" Topmost="True">
        <Button Content="Test" Width="200" Height="100" />
    </Window>
    

    @lindexi has posted this issue and this solution into his post. If you want more information about this issue, read win10 17025 touch bug - lindexi for more details. (This post is written in multiple languages, so you'll miss nothing even if you ignore the unknown characters.)

    Actually, I still can't figure out why this property helps.

    Could anyone explain the reason for this issue?

    0 讨论(0)
提交回复
热议问题