Tap and Click Events

,

Since the release of the Windows Phone 7.1 SDK, the Click event of the ButtonBase class has been superseded by a UIElement event named Tap. The Tap event is designed for touch input, while the Click event relies on legacy code that handles mouse state.


Note

While the ButtonBase Click event is still present in the SDK, unless your UI code needs to be shared with Silverlight for the browser projects, use the Tap event.


The following is an example of a UIElement.Tap event handler.

void Button_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
...
}


Note

There is another public GestureEventArgs class residing in the Windows Phone Toolkit that is, unfortunately, located in the Microsoft.Phone.Controls namespace. If you are using the Windows Phone Toolkit, be mindful that the correct type needs to be specified or a runtime exception will be raised.

Either use the namespace qualified type name, as shown in the previous example, or add a type alias to the top of your class file, like so:

using GestureEventArgs = System.Windows.Input.GestureEventArgs;


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.131.25