WPF Listview touch issue on window 10: "an event of another datatemplate is triggered while it may not happen"

Charles He-MSFT 96 Reputation points Microsoft Employee
2020-03-27T07:51:15.527+00:00

This a MSDN question asked by Free_development, the source is WPF Listview touch issue on window 10: "an event of another datatemplate is triggered while it may not happen"

Before we start:- (links will be provided later)

Detailed information of the problem can be found on stackoverflow.

We have created a simple test-project, which is used to simulate the problem on windows 10 (touch only), and can be found on github.

In short below a summary of the technical setup:

  • We use a grouped listview, and for each group, a togglebutton and another (inner) listview.
  • The inner listview uses an ItemTemplateSelector binded to an Datatemplate selector, to choose an datatemplate.
  • There are 3 datatemplates (checkbox, numeric, text) that will be choosen based upon the type property of the bounded model.
  • Each datatemplate has a stackpanel. The stackpanel in the text en numeric datatemplate is wired to an PreviewMouseDown event.
  • Important, the stackpanel in the checkbox isn't wired to an event.

So, what is the problem?: Sometimes, when touching the checkbox, the PreviousMouseDown of another template is triggered.

I would expect that this behavior may not happen, is that correct?

Also if we no longer listen to the stylus event and configuring to DisableStylusAndTouchSupport the problem can no longer be simulated?

Any idea's, or insights on the rootcause of this problem or a solution?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,696 questions
{count} votes