Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

execute code when TextBox is tapped or clicked?

I tried this event handlers on my textbox:

private void TextBox_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
    //do this
}

I also tried LayoutUpdated, SelectionChanged, PointerEntered, PointerReleased. None of them execute codes as soon as I click the box.

like image 751
Hendra Anggrian Avatar asked Oct 17 '12 10:10

Hendra Anggrian


1 Answers

This is because of the Textbox other messages prevents to trigger the Tapped event before it gets fired. Add the below code in the constructor of the page where you use Textbox. Tap event will be triggered.

textBox.AddHandler(TappedEvent, new TappedEventHandler(textBox_Tapped_1), true);

Please refer this link : TextBox Tapped event not being called in Windows 8 RC

like image 200
sankar Avatar answered Nov 08 '22 07:11

sankar