I am using devexpress TextEditSettings in dxgrid in editsetting开发者_运维问答s..
How can i restrict the user to enter value with 3 decimal places and value range should be 0-1000
Give this a try:
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
<Style x:Key="DXTextEdit_Numeric_Style" TargetType="{x:Type dxe:TextEdit}">
<Setter Property="Mask" Value="000.000;000.000-" />
<Setter Property="MaskType" Value="Numeric"/>
<Setter Property="DisplayFormatString" Value="000.000;000.000-"/>
<Setter Property="MaskUseAsDisplayFormat" Value="True"/>
</Style>
EDIT:
Give this a try:
You will have to specify your column:
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
<dxg:GridColumn FieldName="SomeFieldName" Width="110" FilterPopupMode="CheckedList">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings Style="{DynamicResource GridColumnStyle_Text}" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
Then your style:
<Style x:Key="GridColumnStyle_Numeric" TargetType="{x:Type dxe:TextEditSettings}">
<Setter Property="Mask" Value="000.000;000.000-" />
<Setter Property="MaskType" Value="Numeric"/>
<Setter Property="FlowDirection" Value="RightToLeft"/>
<Setter Property="DisplayFormatString" Value="000.000;000.000-"/>
<Setter Property="MaskUseAsDisplayFormat" Value="True"/>
</Style>
精彩评论