Hi Team,
I have an issue with xam numeric editor loosing focus which has a precision of two.When i enter the first digit the focus is lost.Not waiting for the second to enter.
Any help would be greatly appreciated.
Xaml Code:
<igEditors:XamNumericEditor HorizontalAlignment="Right" Grid.Column="3" InvalidValueBehavior="RevertValue" MinHeight="20" Height="25" Margin="3,0,3,0" IsAlwaysInEditMode="True" IsKeyboardFocusWithinChanged="UIElement_OnIsKeyboardFocusWithinChanged"> <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> <Setter Property="IsAlwaysInEditMode" Value="True"></Setter> <Setter Property="Tag" Value="{Binding ElementName=UcTelemetryWorkspace}"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding IsChecked, ElementName=RbDataDensity}" Value="True"> <Setter Property="Mask" Value="{}{double:4.1}"></Setter> <Setter Property="Text" Value="{Binding Data.ExpectedDataDensity,UpdateSourceTrigger=PropertyChanged}" ></Setter> <Setter Property="ValueType" Value="{x:Type sys:Decimal}"></Setter> <Setter Property="MinWidth" Value="35"></Setter> <Setter Property="Width" Value="50"></Setter> </DataTrigger> <DataTrigger Binding="{Binding IsChecked, ElementName=RbRepeats}" Value="True"> <Setter Property="Text" Value="{Binding Data.RepeatData,UpdateSourceTrigger=PropertyChanged}" ></Setter> </DataTrigger> </Style.Triggers> </Style> </igEditors:XamNumericEditor.Style> <i:Interaction.Triggers> <i:EventTrigger EventName="KeyUp" > <i:InvokeCommandAction Command="{x:Static controller:JobConfigurationCreatorController.RefreshReportGraphCommand}" CommandParameter="{Binding ElementName=UcTelemetryWorkspace}"/> </i:EventTrigger> </i:Interaction.Triggers> <igEditors:XamNumericEditor.ValueConstraint> <igEditors:ValueConstraint MinInclusive="1" MaxInclusive="99"></igEditors:ValueConstraint> </igEditors:XamNumericEditor.ValueConstraint> </igEditors:XamNumericEditor>
<igEditors:XamNumericEditor HorizontalAlignment="Right" Grid.Column="3" InvalidValueBehavior="RevertValue"
MinHeight="20" Height="25" Margin="3,0,3,0" IsAlwaysInEditMode="True"
IsKeyboardFocusWithinChanged="UIElement_OnIsKeyboardFocusWithinChanged"> <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> <Setter Property="IsAlwaysInEditMode" Value="True"></Setter> <Setter Property="Tag" Value="{Binding ElementName=UcTelemetryWorkspace}">
</Setter> <Style.Triggers> <DataTrigger Binding="{Binding IsChecked, ElementName=RbDataDensity}" Value="True"> <Setter Property="Mask" Value="{}{double:4.1}">
</Setter> <Setter Property="Text" Value="{Binding Data.ExpectedDataDensity,UpdateSourceTrigger=PropertyChanged}" ></Setter> <Setter Property="ValueType" Value="{x:Type sys:Decimal}">
</Setter> <Setter Property="MinWidth" Value="35">
</Setter> <Setter Property="Width" Value="50">
</Setter> </DataTrigger> <DataTrigger Binding="{Binding IsChecked, ElementName=RbRepeats}"
Value="True"> <Setter Property="Text"
Value="{Binding Data.RepeatData,UpdateSourceTrigger=PropertyChanged}" >
</Setter> </DataTrigger> </Style.Triggers> </Style> </igEditors:XamNumericEditor.Style> <i:Interaction.Triggers> <i:EventTrigger EventName="KeyUp" > <i:InvokeCommandAction Command="{x:Static controller:JobConfigurationCreatorController.RefreshReportGraphCommand}" CommandParameter="{Binding ElementName=UcTelemetryWorkspace}"/> </i:EventTrigger> </i:Interaction.Triggers> <igEditors:XamNumericEditor.ValueConstraint> <igEditors:ValueConstraint MinInclusive="1" MaxInclusive="99"></igEditors:ValueConstraint> </igEditors:XamNumericEditor.ValueConstraint> </igEditors:XamNumericEditor>
Hello Sridhar,
I have created a XamNumericEditor that mimics the one that you are using, but it does not lose focus after typing on my end. There is one thing I am mainly curious about in this case, though. I see that you have an EventTrigger for the KeyUp event hooked into a JobConfigurationCreatorController.RefreshReportGraph command. This will fire each time you type in the editor, and I believe this could be the source of this focusing behavior that you are seeing.
There are a couple of other things that I was missing, as well. For instance, I don't know what XamMaskedEditorBaseStyle entails, and I don't know what is happening in the IsKeyboardFocusWithinChanged event on your end.
Would it be possible for you to please provide some more information on these three points? Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer