如何限制可以输入TextBox的字符数? WPF

时间:2021-11-01 09:12:04

How do I limit the number of chars that can be entered into a TextBox?

如何限制可以输入TextBox的字符数?

<TextBox Height="23" Width="160" Margin="5,0,0,5" x:Name="gTBxFind"/> 

1 个解决方案

#1


2  

With MaxLength

<TextBox MaxLength="20" Height="23" Width="160" Margin="5,0,0,5" x:Name="gTBxFind"/> 

#1


2  

With MaxLength

<TextBox MaxLength="20" Height="23" Width="160" Margin="5,0,0,5" x:Name="gTBxFind"/>