We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Convert Value

Hello Everyone,

we got a problem which we are currently working on.
We want to use a DoubleTextBox or a similar WPF-Element.
The Issue is:

The user should be able to type 345 in the field and it got automatic corrected to 3.45
If he types 35 it should be 0.35
If he types 4.56 it should be 4.56
So far we implemented a Converter for the binding which do this very well.
But if the value is entered through database as a decimal value like 300 which ist 300.00
the converter look for the point "." -> didn't find it and place one so 300 is now 3.00
This is wrong. 
If the database value is 312.45 it works well. The decimal cut off all zero digits :/

We are currently not able to use our converter for this.

Does anyone has an idea for our problem? Is there a WPF-Element from syncfusion which does this so far?

6 Replies

VI Vinothini Syncfusion Team May 9, 2017 07:16 AM UTC

Hi Benjamin, 
From your update, we could find that you are trying to parse values with two decimal digits. Also you have reported that issue occur only when passing the value from database, we believe that handling the database value in convertor will meet your requirement. Can you share us the convertor which you have used? 
We can try it and provide you a solution. 

BS Benjamin Siegmund May 9, 2017 08:39 AM UTC

Hello Vinothini,

thanks for your reply.
I added a sample project to show you my problem.
In the MainWindow you have 2 fields.
A standard textbox and a doubletextbox.
In the standard textbox you can see that there is a binding value of 23. This should be 23. The converter correct it to 0,23 what is wrong.
If you type 27 in the textbox you get the correct 0.27 and if you type 2700 you get the correct 27,00. 
So in the Doubletextbox the value 24 is displayed correct but if you type anything else it gets null.

I hope you can understand my problem. 

Thank you.

Attachment: Sample_ec8557d3.zip

VI Vinothini Syncfusion Team May 10, 2017 04:42 PM UTC

Hi Benjamin, 
Thank you for your update. 
We have checked your converter and we could find that in convertback you have checked for the Decimal and string type for targetType object. But the value passed from the DoubleTextBox is not of that type and hence null value is returned. We have modified your sample and it is available in below location. 
For the issue related to the zeroes after the decimal getting cut off, we are analyzing on that and we will update you the details before the end of 11th May,2017. 

VI Vinothini Syncfusion Team May 11, 2017 12:16 PM UTC

Hi Benjamin, 
In the below stackoverflow link, you have mentioned that the solution works on your side. 
Please let us know if you need any further assistance on this. 

BS Benjamin Siegmund May 12, 2017 09:47 AM UTC

Thanks a lot. Our problem is solved with your solution for the SF Doubletextbox.
The problem was fixed for the normal textbox by the code in stackoverflow.

Best regards

PB Priyanga Balasubramaniam Syncfusion Team May 15, 2017 05:33 AM UTC

Hi Benjamin,

Thank you for the update.

We are glad to hear, your problem was solved at your end.

Let us know if you need any other assistance on this.

Priyanga B

Live Chat Icon For mobile
Up arrow icon