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

IntegerTextBox always defaults to "0". Want Null.

Hi,
I am having trouble setting the default value of IntegerTextBox to null.
Her is the code I am using:
<syncfusion:IntegerTextBox BorderThickness="0.5,0,0,0.5" ParameterValue="buy" BorderBrush="{StaticResource SeparatorBrush}" 
                                                        Value="{Binding Quantity}" UseNullOption="True" Height="18.46" NullValue="{x:Null}" MinValue="0"/>

I am using this text box in the itemsTemplate of an itemsControl. It is showing 0 always.

3 Replies

AA Arulraj A Syncfusion Team November 12, 2018 06:06 AM UTC

Hi Vasudeva

Thank you for contacting Syncfusion Support.

We have checked the reported query and understood that you want to set the null in the Integer Textbox. On observing your code, we could understood that you have not bound the value as nullable type. To achieve your requirement, you need to bound the value using int? nullable value type. The same has been explained in our sample and please download it from the following link:

Sample: http://www.syncfusion.com/downloads/support/forum/140849/ze/IntegerTextboxApplication153114976

Please refer the following KB for the more information
KB: https://www.syncfusion.com/kb/4420/how-to-display-a-blank-in-the-editors-when-the-databound-value-is-null

Please try this solution and let us know if it is helpful.

Regards,
Arulraj A
 



SL Simon Leroux replied to Arulraj A July 20, 2022 02:51 PM UTC

I have similar problem, I can bind to a nullable as in your example it works but when looking at the xaml link failures there is still this message:

Conversion failure of the value 'null'

Is there a way to get rid of this warning?



BA BagavathiPerumal Apranandham Syncfusion Team July 22, 2022 12:15 PM UTC

Hi Vasudeva Naik,


We suggest you to use Converter to convert the property type from int? to long? to avoid XAML Binding Error, otherwise you can change the property type from int? to long?. Please refer to the attached sample for your reference.



Regards,
Bagavathi Perumal A


Attachment: WpfAppIntegerTextBox_f6a3ae4c.zip

Loader.
Live Chat Icon For mobile
Up arrow icon