我在编辑设置中使用dxgrid中的devexpress TextEditSettings ..
如何限制用户输入3位小数值,值范围应为0-1000
答案 0 :(得分:3)
尝试一下:
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>
修改强>
尝试一下:
您必须指定专栏:
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>
然后你的风格:
<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>