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

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

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

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

使用最大长度

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