Jeremy's answer isn't entirely accurate. In another thread someone reported having a problem with taps not working the same way as clicks when clicking/tapping in rapid succession and it is easy to reproduce with the code below and could easily be extended to pointer events.
public sealed partial class MainPage : Page
{
private int clicks = 0;
private int taps = 0;
public MainPage()
{
this.InitializeComponent();
var button = new Button();
button.Width = 500;
button.Height = 200;
button.Content = string.Format("Clicks: {0}, Taps: {1}", clicks, taps);
button.Click += (s, e) => button.Content = string.Format("Clicks: {0}, Taps: {1}", ++clicks, taps);
button.Tapped += (s, e) => button.Content = string.Format("Clicks: {0}, Taps: {1}", clicks, ++taps);
this.Content = button;
}
}
Click
is what you should handle on a regular button. It has the logic that is expected of a button. Among the things I can think of are
- it works with a keyboard as well as with a mouse
- it works even if you press the button and release it slowly
- it can be canceled when you press by dragging away from the button and also resumed by dragging back to it after previously pressing the button
- it is limited to a single button at a time, so if you try to click two buttons together - the first one touched won't click (different than on the original Surface/PixelSense, which supports multi-user interactions!)
- it likely works better with things like automation and as such with accessibility features of Windows
- it always works
As demonstrated in the sample code - the Tapped
event doesn't register for all taps if you tap repeatedly. I'm not sure if this is because some underlying gesture recognition logic sees some double taps or simply rejects every other tap for whatever other reason. It works for quick single touch/pen taps or mouse clicks, but is a generic event that you can handle on any UIElement
and might be used if you want to distinguish between taps, double taps, right taps (!) or holds on arbitrary UI elements.
The pointer events are lower level and you can use them to handle slightly more advanced interactions not already built into the framework. As I mentioned - a click consists of a press and accompanying release both occurring on the button, so a similar interaction could be modeled with pointer events. You could, for example, use it to implement some sort of a Whac-A-Mole/Twister combination type of game where you'd want to mash many UI elements at the same time which you couldn't do with clicks.