Win RT:文本框的正确事件处理程序... [英] Win RT: the right Event Handler for the Textbox...

查看:74
本文介绍了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.


这篇关于Win RT:文本框的正确事件处理程序...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆