本文介绍了确定在 TextBox 中按下 Enter 键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..考虑在 Win Phone 7 中使用 XAML 文本框.
Consider a XAML TextBox in Win Phone 7.
<TextBox x:Name="UserNumber" />
这里的目标是当用户按下屏幕键盘上的 Enter
按钮时,这将启动一些逻辑来刷新屏幕上的内容.
The goal here is that when the user presses the Enter
button on the on-screen keyboard, that would kick off some logic to refresh the content on the screen.
我想要专门为 Enter
引发一个事件.这可能吗?
I'd like to have an event raised specifically for Enter
. Is this possible?
Enter
键?即类似于 ASCII 13?对此需求进行编码的最佳方式是什么?
Is the event specific to the TextBox, or is it a system keyboard event?
Does it require a check for the Enter
on each keypress? i.e. some analog to ASCII 13?
What's the best way to code this requirement?
推荐答案
在文本框中解决此问题的直接方法是
A straight forward approach for this in a textbox is
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
Debug.WriteLine("Enter");
}
}
这篇关于确定在 TextBox 中按下 Enter 键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论