IT tutorials
 
Mobile
 

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

11/25/2014 3:19:53 AM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

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;

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.

 
Others
 
- 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
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS