I have a class that implements IDataErrorInfo and INotifyPropertyChanged that contains properties that have a one to one relationship with a column in a SQL Server Database Table. In this table I am using Decimal datatypes that allow nulls. My properties is the class have a Type of Nullable(Of Decimal). I also have a mask on the field of "$nnnnnn.nn". I have spent 4 hours trying to figure out why I get the following message when inputting "nothing" into a XamEditor field.
"Value '' could not be converted."
I have changed from XamCurrencyEditor to XamMaskedEditor with the same result.
I have also implemented a ValueToTextConvert that simply strips the preceding dollar sign off of the String as shown here from the ConvertBack method.
Dim editior As ValueEditor = DirectCast(parameter, ValueEditor)
If value IsNot Nothing AndAlso value.ToString.Contains("$") Then
value = value.ToString.Replace(
"$","")
End If
Return Infragistics.Windows.Utilities.ConvertDataValue(value, GetType(Decimal), editior.FormatProvider, editior.Format)
I hope I have added enough information to define my issue. Thank you.
I have found that my converter returning a DBNull from the database in the Convert Method causes this issue. I'm confused why the message "Value '' cound not be converted" was being displayed. I think that the Infragistics message should show "Value DBNull could not be converted".
Hello,
Could you please provide us a small project that reproduces this behaviour?
Thanks,
Anastas