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

Error: Value could not be converted

Hi,
I am trying to use the CurrencyTextBox and I am getting the following error.

Value ₹ (START_DIGIT_OF_MY_AMOUNT) can not be converted

Here is my XAML

<syncfusion:CurrencyTextBox  Grid.Column="1" Grid.Row="4" Margin="10,0,0,10" x:Name="Amount" Text="{Binding model.Amount, Mode=TwoWay, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Validation.Error="Validation_Error" MinWidth="200" MaxWidth="400" Culture="en-IN" CurrencyPositivePattern="2" CurrencyGroupSeparator="," CurrencyDecimalDigits="2" CurrencyDecimalSeparator=".">

This field is bound to a model which is declared as double.
public double Amount { get; set; }
Can someone help me resolve this issue?

Thanks

4 Replies

PB Priyanga Balasubramaniam Syncfusion Team February 14, 2017 08:44 AM UTC

Hi Andy,

Thank you for contacting Syncfusion Support.

We have checked your code example. You have bind the double data type property ("Amount") to Text property of CurrencyTextBox. But Text property of CurrencyTextBox data type is String. So, conversion error occurred.

To avoid this error, we have bind the "Amount" property from model class to Value property of the CurrencyTextBox.

Please download the sample from the below location.

Sample:TestWPFApp

Regards,
Priyanga B.


AJ Andy Johnson February 14, 2017 08:51 PM UTC

Priyanga,
Thanks for your code.
In your example and even in my code, when view loads first, it has a Dollar sign ($) instead of a rupee sign. That is not a correct behavior. As soon as you start typing it changes to a rupee sign. Is there any way to fix that?

Thanks


AJ Andy Johnson replied to Andy Johnson February 14, 2017 10:06 PM UTC

Priyanga,
Thanks for your code.
In your example and even in my code, when view loads first, it has a Dollar sign ($) instead of a rupee sign. That is not a correct behavior. As soon as you start typing it changes to a rupee sign. Is there any way to fix that?

Thanks

I also want to start with an empty textbox. As soon as user starts typing, the rupee sign and the amount that they are typing will be appeared.
Is it possible?


PB Priyanga Balasubramaniam Syncfusion Team February 15, 2017 11:17 AM UTC

Hi Andy,

Thank you for your update. Please find the response below for your queries.

Quer#1:"when view loads first, it has a Dollar sign ($) instead of a rupee sign. That is not a correct behavior. As soon as you start typing it changes to a rupee sign"

We were able to reproduce the issue from our side. A support incident has been created to track the status of this issue under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents  

Quer#2:"I also want to start with an empty textbox. As soon as user starts typing, the rupee sign and the amount that they are typing will be appeared.
Is it possible?"

We have modified the last updated sample to meet your requirement. In this sample, we have enabled "UseNullOption" property of CurrencyTextBox to allow null value.

Please download the sample from the below location.

Sample:TestWPFApp

Regards,
Priyanga B


Loader.
Live Chat Icon For mobile
Up arrow icon