Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange Behavior in Touch Application using WPF #9019

Open
Joebu opened this issue Apr 11, 2024 · 6 comments
Open

Strange Behavior in Touch Application using WPF #9019

Joebu opened this issue Apr 11, 2024 · 6 comments
Labels
Investigate Requires further investigation by the WPF team.

Comments

@Joebu
Copy link

Joebu commented Apr 11, 2024

Description

In my touch application developed with WPF, I've encountered a perplexing behavior when interacting with buttons within an ItemsControl. Occasionally, when touching down on one button, the click action seems to be executed on a different button within the ItemsControl.

This issue occurs sporadically and is challenging to consistently reproduce. The buttons within the ItemsControl are utilizing a custom template. I've observed this behavior across multiple touch devices, indicating that it's not specific to a particular hardware configuration.

It's worth noting that this issue seems to be isolated to touch interactions, as it doesn't manifest with mouse input. To aid in diagnosing the problem, I plan to attach a video demonstrating the behavior. In the video, I'll highlight where the touch occurs on the screen and indicate which button erroneously triggers the click event by changing its background color to blue.

touch.issue.mp4

Reproduction Steps

since its random I just can't reproduce but here's my event handler (originally I used command binding but I thought that it might be a bubbling issue )

 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (sender is Button button
          && e.OriginalSource is Button source
          && source == button &&
           button.DataContext is MenuDTO menu
          && this.DataContext is ViewModels.MenuSelectionViewModel vm)
          {
                 _ = ChangeColor(source);
                vm.MenuSelectedCommand.Execute(menu);
           }
   }

additionally I have set the Button Focusable=False

Expected behavior

the button that is touched should raise the event

Actual behavior

randomly a different button raises the event

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

.net: net8.0-windows
Windows 10 Enterprise 19045.4046
AMD Ryzen 9 5900X 12-Core Processor 3.70 GHz
Issue occurs on different configurations as well

Other information

No response

@Kuldeep-MS Kuldeep-MS added the Investigate Requires further investigation by the WPF team. label Apr 12, 2024
@lindexi
Copy link
Contributor

lindexi commented Apr 13, 2024

@Joebu Maybe the Manipulation eat your touch event. Reference #8223 (comment)

@Joebu
Copy link
Author

Joebu commented Apr 15, 2024

@lindexi What would be the remedy

@lindexi
Copy link
Contributor

lindexi commented Apr 16, 2024

@Joebu Could you test disable the Manipulation ?

@Joebu
Copy link
Author

Joebu commented Apr 18, 2024

@lindexi does it make sense that the following fixed the issue?
AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);

@lindexi
Copy link
Contributor

lindexi commented Apr 19, 2024

@Joebu Sorry, I do not think so.

@Joebu
Copy link
Author

Joebu commented Apr 19, 2024

But it did.
I didn't mention that I am using an elo touch screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Requires further investigation by the WPF team.
Projects
None yet
Development

No branches or pull requests

3 participants