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 a lot for your reply. I was waiting for it impatiently. :)
yes, you understood it right but I don't want that the control to shows that "value" could not be conveted error" on null value. Also don't want to change my property to nullable property.
Either it does not allow me to focus out or does not show "value" could not be conveted error" on invalid value.
Also I have noticed that after clearing value in xamNumericEditor and changing tab instantly, the invalid value error pops up 15-20 times.
I want a fix for this also.
Is this possible that the control does not let focus out at all on invalid value ?
One more thing can we show these invalid value error in tooltip rather than in messagebox.
Thank you in advance.
Regards
NK
Thank you for your feedback.
I have been looking into your post and it seem that the behavior that you have described derives from your data and converter. As I mentioned in my previous post when you clear the XamNumericEditor it will return null and will try to save that. There is property named Nullable in your ValueConstraint that indicates if the user is allowed to delete all the contents of the editor. In order to be able to avoid the invalid value popup when deleting all contents of the editor you should set this property to True. You can take a look for more details about the functionality of Nullable property at 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.ValueConstraint~Nullable.html
I modified your sample application. I modified your converter and use it to bind your property to the Value of XamNumericEditor. Also you can take a look at the following forum thread, where similar issue was discussed,it can be of help to you: http://es.infragistics.com/community/forums/t/87601.aspx , please let me know If I am missing something from your scenario.
Please let me know if you need any further assistance on the matter.
I think you didn't understood my concern. I don't want to stop that null value pop-up. I want to get rid of that red highlighted error on my numeric editor that say "Value ''could not be converted " on null value or at-least change than error tooltip.
Secondly, I didn't understand how changing float converter works at your end. You haven't passed any converter Parameter, also it wont get into any of the switch case after your change. please help me to understand here.
3rd and most important when I change tab after putting invalid value in xamNumericEditor , error pops up 15-20 times. Does this happens to your end also. Please help me in this.
Nkaur
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.
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. :)
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.
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.
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