如何设置组合框中输入文本的长度? [英] How can I set the length of entered text in a combobox?
本文介绍了如何设置组合框中输入文本的长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置 ComboBox 的输入文本长度?
How can I set a ComboBox's entered text length?
例如,它不会超过 20.
That it would not be longer, than 20, for example.
推荐答案
我通过 XAML<找到了一个简单的解决方案/a>.在 ComboBox 资源中,我们可以设置文本框的样式并通过 setter set maxlenth.
I found an easy solution via XAML. In ComboBox resources we can set the style for a textbox and via setter set maxlenth.
<ComboBox Name="comboBox" Width="100" IsEditable="True">
<ComboBox.Resources>
<Style TargetType="{x:Type TextBox}">
<Setter Property="MaxLength" Value="yourValue"/>
</Style>
</ComboBox.Resources>
</ComboBox>
这适用于 Actipro ComboBox.对于通常的组合框来完成这项工作,请查看 此处
This works with Actipro ComboBox. For usual comboBox to make this work, have a look here
这篇关于如何设置组合框中输入文本的长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文