Hi Team,
I need the user to prevent entering zero i have placed the value constraint but it is not working as expected.Below is the code i have written.
<igEditors:XamNumericEditor HorizontalAlignment="Right" Grid.Column="0" Text="{Binding Data.RepeatData,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" InvalidValueBehavior="RevertValue" MinHeight="20" Margin="0,0,10,0">
<igEditors:XamNumericEditor.Style> <Style TargetType="{x:Type igEditors:XamNumericEditor}" BasedOn="{StaticResource XamMaskedEditorBaseStyle}"> <Setter Property="Mask" Value="{}{double:2.0}"></Setter> <Setter Property="ValueType" Value="{x:Type sys:Decimal}"></Setter> <Setter Property="MinWidth" Value="25"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding IsChecked, ElementName=RbDataDensity}" Value="True"> <Setter Property="Mask" Value="{}{double:2.1}"></Setter> <Setter Property="ValueType" Value="{x:Type sys:Decimal}"></Setter> <Setter Property="MinWidth" Value="35"></Setter> <Setter Property="Width" Value="35"></Setter> </DataTrigger> </Style.Triggers> </Style> </igEditors:XamNumericEditor.Style>
<i:Interaction.Triggers> <i:EventTrigger EventName="TextChanged" > <i:InvokeCommandAction Command="{x:Static controller:JobConfigurationCreatorController.RefreshReportGraphCommand}" CommandParameter="{Binding }" /> </i:EventTrigger> </i:Interaction.Triggers>
<igEditors:XamNumericEditor.ValueConstraint> <igEditors:ValueConstraint MinInclusive="1" MaxInclusive="99"></igEditors:ValueConstraint> </igEditors:XamNumericEditor.ValueConstraint> </igEditors:XamNumericEditor>.
Appreciate your help on this.
Regards,
Srikanth.
You didn't specify exactly what behavior you expected, so I'm going to interpret "prevent entering zero" to mean that when the user types a "0", the control does not accept the input. This, however, is not the way the control works - validation is performed when the control exits edit mode, i.e., loses the input focus.
I attached a simple test project that uses as much of the code you posted here as I could (some members were defined elsewhere in your project so I was not able to reference them) that demonstrates the control rejecting an input value of zero. If you type zero as the value and then exit the control, you will see the value revert to the last valid one.
If there is more to this please clarify or ideally, include a simple project that reproduces the problem so we can take a closer look.