奇怪的行爲!當我點擊地鐵應用程序上的按鈕時效果很好,但是當我點擊進入(KB上的按鈕)時,唯一發生的事情就是一切都被清除了!2種類型的點擊事件相同的代碼2導致winrt
這種失敗
private void TextBox_KeyDown_1(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Enter)
{
textBlock.Text = textBox1.Text;
// textBox1.Text = "";
}
}
可正常工作
private void Send_Click(object sender, RoutedEventArgs e)
{
textBlock.Text = textBox1.Text;
textBox1.Text = "";
}
我在做什麼錯?
感謝
你有AcceptButton屬性集嗎?你有KeyPreview設置爲真? –