Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我阅读了一些关于如何制作只接受数字的文本框的精彩帖子?
但是,我在 Windows 8 中找不到同样的东西,没有 Key Press 事件处理程序。还有其他解决方案吗?
没有“OnKeyPressed”,但您有“KeyDown”事件。
<TextBox KeyDown="TextBox_KeyDown_1"/>
然后在 C# 中:
private void TextBox_KeyDown_1(object sender, KeyRoutedEventArgs e) { //check IsDigit. }