Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi my friends,

well, I need your help with finding the right event for the textbox here... I like to let the user write some information in it, when he presses enter it should be added to a label. well thats easy, but which is the right event for touch input? could anyone please help me here?

Thanks a million times!

Alex
Posted

1 solution

Hello,

Is "Enter" a button or the keyboard key "enter"?

If it is a button, I would use the button's tapped event, the click event occurs before and you could use it too.
If it is the keyboard key then a good place to put your code is the keyup event of the TextBox

C#
private void textBox1_KeyUp(object sender, KeyRoutedEventArgs e)
{
    if (e.Key == Windows.System.VirtualKey.Enter)
    {
        textBlock1.Text = textBox1.Text;
    }
}


All these events are fired if you use a touch interface or a mouse, so there should be no problems.

Valery.
 
Share this answer
 
Comments
Alex Großmann 17-Jan-13 6:17am    
Thank you so much!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900