Hi,
I am using a XamNumericEditor with masking property. Everything working fine except when I clear the XamNumericEditor it goes red and give a
"Value '' could not be converted" tooltip message. can I get rid of this message or atleast change it to a custom message.
Here's my code
<igEditors:XamNumericEditor x:Name="ValueFrequency2" Width="170" Style="{StaticResource XamNumericEditorStyle}" Height="23" Text="{Binding Frequency, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,TargetNullValue=''}" Mask="{}{double:-4.5}" AlwaysValidate="True" InvalidValueBehavior="Default" PromptChar=" " > <igEditors:XamNumericEditor.ValueConstraint> <igEditors:ValueConstraint ValidateAsType="Double" MinInclusive="1" Nullable="False" MaxInclusive="9999" /> </igEditors:XamNumericEditor.ValueConstraint> </igEditors:XamNumericEditor>
I have binded it with a non-nullable double property.
Please help.
Thanks in advance
nk
Hey...
Anybody listening to this issue?
Hello Nkaur,
Thank you for your post.
I have been looking into the sample application that you have provided and I am not completely sure that I understand your issue correctly. If this behavior is appear when you delete the value of editor, it is expected because it will return null and will try to save that in the underlying object( because you have set the binding mode to TwoWay and your object is from double instead of double? type). That I can suggest in order to be able to achieve the behavior that you are looking for is to change the type of property from your underlying data that you bind to XamNumericEditor`s value to double? . Please let me know if I am missing something from your scenario and if that is not the case, so I will investigate it further for you.
If you require any further assistance, please do not hesitate to ask.
Hi Zhivko Nikolov,
Thanks for the post.
Thanks for investigating the issue, I will try to upgrade my infragistics soon.
One last query can I show the mask error in tooltip rather than message pop-up.
Thanks in advance.
nkaur
I have been looking into your requirement. In order to be able to achieve the functionality that you are looking for you can set the InvalidValueBehavior property of XamNumericEditor to RetainValue, so the editor will retain value and stay in edit mode instead of display the error message. You can read more details about it from the following link from our online documentation:
http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=InfragisticsWPF4.Controls.Editors.XamMaskedInput.v15.1~Infragistics.Controls.Editors.InvalidValueBehavior.html
Also you should handle EditModeValidationError event of XamNumericEditor, which raised when the editor has an input validation error(invalid value). In the event handler of this event you can get the editor by sender and set it`s ToolTip property to the ErrorMessage property that derives from EditModeValidationErrorEventArgs and contains the current error message. If you want to set some border when the editor value is invalid you can use the same event set the its BorderBrush property to some Brushes. In order to be able to clear the tooltip and brushes when the editor`s value is correct you can handle ValueChanged event of XamNumericEditor and in the event handler you can determine whether the editor`s value is valid and if it is you can perform the needed operation to clear them. In order to be able to raise these events you should set IsAlwaysInEditMode property of XamNumericEditor to False.
If you need from more details about EditModeValidationError event, please take a look at the following link:
http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v15.1~Infragistics.Windows.DataPresenter.DataPresenterBase~EditModeValidationError_EV.html
I modified the last sample application from my post, to show you how you can implement this approach and achieve the functionality that you are looking for.
Please let me know if you need any further assistance on the matter.
Hello,
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.
Sorry for the late reply, I was working on some other task lately.
Yes your last post was very helpful. Thank you so much for your time and patience. :)
Thank you for your feedback.
I am very glad that my suggestion was helpful for you. Please do not hesitate to ask if you require any further assistance on the matter.