This article is written in both English and Chinese. 本文使用中文和英文两个版本。 在 win10 的 17025(直到 17134 也就是正式版 1803 也没有修复) 可以容易让 UWP 触摸失效。做法是创建一个窗口背景是透明的 wpf 程序,把他置顶,这时所有 uwp 程序就无法触摸。在正式版 17134 是所有的触摸程序都触摸失效,除了可以把触摸转鼠标的程序如 VisualStudio 和 QQ 还能使用,如 Edge 和 Chrome 都无法使用。 I found the easy way to make the UWP app touch not work in win10 17025(until 17134). To create a wpf app with transparent background and make it Topmost, you can see all of the UWP app’s touch not work.
写英文的原因是给微软报这个问题,现在发在 微软反馈 希望大家投票。
步骤:
这时就可以看到 Edge 等软件都无法触摸
在检查的时候可以使用ManipulationDemo,可以看到在触摸的时候没有 Pointer 消息。
下面是关闭 wpf 程序之后,可以看到最下面有 Pointer 消息
下面是这个wpf软件代码:
public MainWindow()
{
InitializeComponent();
AllowsTransparency = true;
WindowStyle = WindowStyle.None;
WindowState = WindowState.Maximized;
Background = Brushes.Transparent;
Topmost = true;
}
最新的微软补丁August 30, 2018—KB4346783 修复了这个问题,只需要在用户的设备安装这个补丁就可以解决
下面是不使用补丁的方法
如果设置了一个窗口满足下面的属性
WindowStyle = WindowStyle.None;
WindowState = WindowState.Maximized;
或
WindowStyle="None"
AllowsTransparency="True"
那么就必须要设置 ResizeMode="NoResize"
不然就会出现下面的问题
AllowsTransparency = true;
窗口下面所有程序触摸失效
Step:
Then you can see all of the uwp app’s such as edge and setting touch not work.
You can use ManipulationDemo to help you see the Pointer message that cant get when touch. I use ManipulationDemo to find the pointer message have not be received. The app can only receive the mouse message.
I took an image that shows the pointer message when I closed the wpf app.
This is the wpf app’s code:
public MainWindow()
{
InitializeComponent();
AllowsTransparency = true;
WindowStyle = WindowStyle.None;
WindowState = WindowState.Maximized;
Background = Brushes.Transparent;
Topmost = true;
}
This is my system and I think in win10 17025 the windows cant make the app uses pointer message to work that exists another transparent background app in above.
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.
If you have a Window that set the following properties.
WindowStyle = WindowStyle.None;
WindowState = WindowState.Maximized;
Or
WindowStyle="None"
AllowsTransparency="True"
You must set ResizeMode="NoResize"
to avoid some problems as
Maximized
from Normal
.