Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Click event handler to TextBlock on Window phones

I am writing a application for c# on windows phones. I create a TextBlock in my page using xaml. How can I add click event handler in xaml. I tried using 'Click' as attribute, but that is not a valid attribute for TextBlock.

Thank you.

like image 971
hap497 Avatar asked Oct 08 '14 21:10

hap497


1 Answers

It's the Tappedevent (Sopuli was almost right). Just a tip for you: on the right hand side of the window is the property explorer. If you click on the event icon on the upper right you will get a list of all events the control exposes.

Just double click inside one of the fields next to the text and the Visual Studio will create the event for you and put a handler in the code behind file.

Event Handlers

like image 177
Fred Avatar answered Oct 31 '22 01:10

Fred