I am developing a solution that will be used solely on touch computers. Should I use Click, TouchDown, PreviewTouchDown to listen to the event of clicking the button on the touchscreen using touch? Originally I was using Click but I noticed in some cases that the event didnt fire on first finger tap on the touch screen and had to touch it again to fire. I am using .NET 4.8. Thanks!
CodePudding user response:
If you handle the TouchDown
and also set the Stylus.IsPressAndHoldEnabled
attached property of the Button
to false
, the event should be raised as soon as the finger touches the screen:
<Button Content="Touch" TouchDown="Button_TouchDown" Stylus.IsPressAndHoldEnabled="False" />
By default and as stated in the docs, the event doesn't occur until a finger touches the screen and moves.