惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - 旻

关于WPF性能 Sysinternals 实用工具:进程 又关注了一下WPF/SL的混淆问题 随手日记 0525 随手日记 0524 客户端类型软件与用户规模表 2D MatrixTransform的原理 随手日记 0510 将数字世界和真实世界结合的视频。MIT牛人。 WPF 的资源 Ideum的100英寸触摸屏支持50个触摸点 微软多点触摸鼠标视频图片荟萃 [转]win7多点触控的十万个为什么 监听所有的依赖属性 搜集几个多点触摸的视频 Public Computer——未来电脑的新分支,多点触摸的新舞台。 7.10 WPF 流水账 Tooltip自定义模版后不能显示内容的问题——ControlTemplate的秘密 - 旻 6.4 流水账-拖拽,又见拖拽 流水账 5.26 Dell XT2被大卸八块
限制WPF Text中的输入字符和长度
· 2009-08-07 · via 博客园 - 旻

如何让TextBox只能输入数字或字母,如何限制输入字符串的长度?

这些都是比较常用的功能。

微软推荐的方法是使用Validator,即数据验证器。

不过这种方法是“先输入”“再验证”。如果想在输入的时候做出限制,比如对于只能输入数字的TextBox,当用户按下字母键的时候根本没反应,验证器就做不到了。

在网上搜索可以使用Limit TextBox Input in WPF或者Number only Text WPF 的关键字来搜索。

应该可以找到你满意的答案,这里就没必要贴出来了。只是有一些主意事项要提醒一下:

1. 别忘了限制Ctrl+V,还有右键菜单,Shift+F10,还有104键盘上的“快捷菜单”按键。

2. 软键盘也要限制。

网上有代码,也有现成的控件。