Winrt Xaml Tapped Event Responds Slowly While Clicked Responds Rapidly

▼魔方 西西 提交于 2019-12-23 05:31:03

问题


I recently created a custom entry pad with buttons that the user may be clicking rapidly (it is basically a custom numeric entry pad). The problem is that if the button tapped event is used to register the handler for the entry pad key it responds so slowly that button presses are missed (meaning if I rapidly press the number 2 five times, maybe 2 or 3 twos show up). Changing the event from Tapped to Clicked (same code otherwise) causes the entry pad to be fully responsive.

Why is it that the Tapped event handler is so unresponsive and is are there any potential repercussions for using the Tapped instead of the Clicked handler?


回答1:


I haven't used it enough to verify, but it's likely to support double tapped events. Perhaps if you set IsDoubleTapEnabled to false then tap events will come in sooner.




回答2:


This answer really comes from Filip Skakun's comments on the other answer he gave on this post, but to make it easy for people to find this answer, I'm going to post it separately. If Filip edits his answer or posts this as a new one, I'll remove mine so that he's can be the one getting the credit.

The solution that worked for me was to use the PointerReleased event instead of the Tapped event. When using Tapped I only received about half of my events if the clicks/taps were in quick succession. However, if I used PointerReleased instead, then I received all of my events.



来源:https://stackoverflow.com/questions/21820482/winrt-xaml-tapped-event-responds-slowly-while-clicked-responds-rapidly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!