【发布时间】:2017-02-07 07:03:42
【问题描述】:
我需要将文本编辑控件中的用户输入限制为 1-99。看了这张票https://www.devexpress.com/Support/Center/Question/Details/Q458791之后,使用了一个RegEx掩码来实现它。
<dxe:TextEdit Grid.Column="2" Text="{Binding FontSize , UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Grid.Row="1" VerticalAlignment="Center" MaskType="RegEx" MaskUseAsDisplayFormat="True" Mask="^[1-9]\d?$" EditValueChanged="TextEdit_EditValueChanged"/>
现在它也在输入区域 (^[1-9]\d?$) 中显示掩码字符串。尝试了不同的 reg ex 组合。请帮忙。
【问题讨论】:
-
不要使用掩码作为显示格式。您不会转换或更改格式。
-
不走运,:(。如果我输入 10,它将显示 ^10$
-
起来,我的错!删除 ^ 和 $。你不需要那个。我会尽快解释为答案:)
-
成功了。谢谢
标签: devexpress-wpf