6

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 reaction. This can only be reproduced when Windows 10 is upgraded to 1803 (10.0.17134.0).

<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" Background="Transparent"
        Topmost="True">
    <Button Content="Test" Width="200" Height="100" />
</Window>

I wrote another WPF application to find out what happened. So I add a StylusDown event to the Window like the code shown below:

// This code is in another WPF application.
private void OnStylusDown(object sender, StylusDownEventArgs e)
{
    // Set a breakpoint here.
}

But the breakpoint never reached until I closed the transparent WPF window which is on top.

I pushed the very simple code to GitHub: dotnet-campus/TouchIssueOnWindows10.0.17134. Cloning it might help a little.

Why does this happen and how to solve it? Any reply is appreciated.

8
  • I try to set the TouchIssueOnWindows to 4.7 and support pointer but I find it cant use Pointer message in another application.
    – lindexi
    May 17, 2018 at 2:48
  • I found I cant touch any UWP, like edge and twitter, until I closed the TouchIssueOnWindows
    – lindexi
    May 17, 2018 at 2:53
  • How about setting Background="{x:Null}"?
    – Iron
    May 17, 2018 at 3:22
  • @Iron It still reproduces even if the background is null.
    – walterlv
    May 17, 2018 at 3:27
  • May be the window is eating your events. Try diabling the hittest on the window. May 17, 2018 at 6:36

1 Answer 1

4

Updated

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

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?

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.