Home > Back-end >  WPF touch events
WPF touch events

Time:02-10

I have a WPF app. In this app context menus are defined in XAML inside border elements. Unfortunately I don't have a Windows device with touch functionality.

1) If these elements are operated by touch and the user presses a little longer on one of the border elements, does the context menu open automatically? Or do I have to open the context menu myself depending on the time between the TouchDown event and the TouchUp event?

2) My app is so far operated by clicking with the mouse on TextBlock and Border elements. These do not have a Click event. Therefore I react on their MouseLeftButtonUp events. If these elements are now operated by touch, do I have to react to touch events or are MouseLeftButtonUp events already triggered automatically?

CodePudding user response:

Some touch inputs will trigger mouse events if conditions are met. But it will be hard to figure out these interactions without actual touch device. Said that, the answers are:

1 Touch press and hold will be translated to right click by the OS. So yes, context menu will open.

2 No, you need to implement custom click event utilizing touch events.

  • Related