Nestor
Nestor

Reputation: 8384

DevExpress TextEdit RegEx MaskType not limiting length

I intend to have a TextEdit that can have a maximum 4 digit length positive number.

I use the following TextEdit:

<dxe:TextEdit Name="txtNumber" Mask="\d+{0,4}" MaskType="RegEx" />

I can put exactly 10 digits in it without any sign of overflow. After that I can put more numbers, the TextEdit turns red but keeps letting me to add more digits.

What should I use to stop the user at 4 digits without using some code-behind magic?

Upvotes: 1

Views: 642

Answers (1)

nempoBu4
nempoBu4

Reputation: 6621

You can use numeric mask type with ####; as mask:

<dxe:TextEdit Name="txtNumber" Mask="####;" MaskType="Numeric"/>

Upvotes: 2

Related Questions