IT tutorials

Windows Phone 8 : Receiving Input with Buttons - Tap and Click Events, Button Click Mode, Hyperlink Button

11/25/2014 3:19:53 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

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.


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)


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;

Button Click Mode

If you need to use the Button.Click event, rather than the Tap event for whatever reason, you can tailor the type of user interaction that is required to raise the Button’s Click event using the Button.ClickMode property.

The following is a list of the three possible ClickMode values:

- PressThe Click event is raised as soon as the user touches the button.

- ReleaseThe Click event is not raised until the user lifts his finger off the button. This is the default value.

- HoverHas the same effect as Press. As there is currently no support for detecting when the user hovers over a control on a Windows Phone device, this value serves no purpose and exists to maintain compatibility with Silverlight for the browser.

Hyperlink Button

The HyperlinkButton allows you to embed hypertext links in a page.

As previously stated, all UIElements have a Tap event, which can be used to perform navigation within an event handler. Performing navigation in this manner, however, can be cumbersome, and the HyperlinkButton provides an easier way to navigate to pages within your app without having to subscribe to an event or use an ICommand.

The HyperlinkButton includes a NavigateUri property. When a user presses the HyperlinkButton, the button takes care of performing the navigation.

The default appearance of the HyperlinkButton does not resemble a button at all. In fact, the default style of a HyperlinkButton is underlined text, not unlike an HTML hyperlink.

- Windows Phone 8 : Receiving Input with Buttons
- Windows Phone 8 : Content Controls - Defining the Default Content Property
- Windows Phone 8 : Control Type Taxonomy - Identifying Controls Not Supported or Absent in Windows Phone
- Windows Phone 8 : Working with People - Facebook Integration (part 5) - Viewing a Friend’s Facebook Albums
- Windows Phone 8 : Working with People - Facebook Integration (part 4) - Writing on a Friend’s Facebook Wall , Viewing Facebook Wall Photos
- Windows Phone 8 : Working with People - Facebook Integration (part 3) - Commenting on a Wall Post
- Windows Phone 8 : Working with People - Facebook Integration (part 2) - Viewing a Wall Post, Viewing Comments to Wall Posts
- Windows Phone 8 : Working with People - Facebook Integration (part 1) - Connecting to Facebook
- Windows Phone 8 : Working with People - Rooms (part 8) - Adding an Appointment to the Shared Calendar , Creating a New Shared Note, Viewing Shared Notes
- Windows Phone 8 : Working with People - Rooms (part 7) - Viewing Shared Photos and Videos, Viewing the Shared Calendar
Top 10
Technology FAQ
- Microsoft ebs security server configuration
- IIs7 on Windows server 2003
- How to Configure Failover Clusters With Win 2008 Server R2?
- Windows 2008 Network Load Balancing
- Windows Server 2008 - Group Policy Management - Remove Computer Management
- Remove shortcuts possibility in a web page or to put in favorite
- HTA Dynamic Drop Down List
- IIS host header and DNS
- VMware or MS Virtual Server?
- Adobe Acrobat 9 inserting tab pages
programming4us programming4us