[英]TextBox Char Length Limit
I searched and didn't find anything that helps my problem. 我进行了搜索,但没有找到任何有助于解决我问题的信息。 I want my textbox and passwordbox to have a 32 character limit.
我希望我的文本框和密码框限制为32个字符。 I tried
MaxLength="32"
but its gives me this error: 我尝试了
MaxLength="32"
但它给了我这个错误:
The member "MaxLength" is not recognized or is not accessible.
无法识别或无法访问成员“ MaxLength”。
What parameter should I use? 我应该使用什么参数?
If you are on WPF, and you are only using XAML as you said than there's no problem using MaxLength, this code makes that TextBox doesn't accept more than 5 chars input: 如果您使用的是WPF,并且仅按照您所说的使用XAML,那么使用MaxLength没问题,那么这段代码将使TextBox接受的字符数不能超过5个:
<Grid>
<TextBox MaxLength="5"/>
</Grid>
if you still have any problem (that I/we can't imagine if you don't wanna post your code) with this, then just try Clean/Rebuild your project. 如果您仍然对此有任何问题(如果您不想发布代码,我/我们将无法想象),则只需尝试清理/重建项目即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.