This example demonstrates how to allow users to enter only positive numbers in WPF Data Editors.
You can use one of the following techniques:
-
Configure a numeric mask.
Use the semicolon (
;
) symbol to specify different masks for positive and negative values. If the negative mask is empty, the text editor does not allow users to enter negative values:<dxe:TextEdit Mask="##0;" MaskType="Numeric" MaskUseAsDisplayFormat="True"/>
-
Use the SpinEdit / SpinEditSettings and specify the SpinEdit.MinValue / SpinEditSettings.MinValue property:
<dxe:SpinEdit MinValue="0" AllowRoundOutOfRangeValue="True"/>
You can also set the ButtonEdit.AllowDefaultButton / ButtonEditSettings.AllowDefaultButton property to
false
to hide the editor's spin up and down buttons.
(you will be redirected to DevExpress.com to submit your response)