WIndows 10 UWP - 如何确定按键是字母还是数字?

WIndows 10 UWP - How can I determine if a Key press is a letter or number?

Windows 10 UWP:示例:在 UWP 网格上,一个 button1.content = 1 和一个文本框。用鼠标按下button1.content,textbox.text中显示1。 textbox.text?

中如何模拟数字小键盘(1)和1

您可以使用 TextBlock.Text 将文本设置为 TextBlock

如果你想知道按键,你应该在Grid

中添加KeyDown
<Grid KeyDown="Grid_OnKeyDown"></Grid>

并添加以下代码

private void Grid_OnKeyDown(object sender, KeyEventArgs e)
{
    var str = e.Key.ToString();
    if (char.IsDigit(str[0]))
    {
        //is digit
    }
    // is letter
}

您可以使用TextBlock.Text = xx设置TextBlock