Win RT:文本框的正确事件处理程序...

问题描述:

我的朋友们,



好​​了,我需要你的帮助,在这里找到正确的文本框事件...我想让用户写一些信息在其中,当他按下输入时,它应该被添加到标签中。这很容易,但哪个是触摸输入的正确事件?有人可以帮我吗?



多亏了一百万次!



Alex

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

您好,



输入按钮或键盘键输入?



如果是按钮,我会使用按钮的点击事件,之前发生点击事件,你也可以使用它。

如果是键盘键然后放置你的代码的好地方是TextBox的keyup事件



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

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





如果使用触摸界面或鼠标,所有这些事件都会被触发,所以应该没问题。



Valery。



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

Valery.