Zero values ​​for integers are not displayed correctly using the Telerik NumericUpDown element

We use the Telerik RadNumericUpDown control (version of 2013) in our application to display and edit both double values ​​and integers; The control works fine for null binary types: it displays nothing for a null value and 0.00 for a value of 0. We want the same behavior for integers, but the control always displays 0 for zero values. I tried setting NullValue to an empty string and null based on the discussion here: http://www.telerik.com/community/forums/silverlight/numericupdown/null.aspx , but this does not solve our problem.

XAML:

<telerik:RadNumericUpDown Value="{Binding Path=Contents, Mode=TwoWay}" NumberDecimalDigits="0" IsEnabled="True" IsEditable="True" IsInteger="True" NullValue="" MinWidth="70" HorizontalAlignment="Left" HorizontalContentAlignment="Left" /> 

The Contents property is a value with a null value.

Any help is appreciated.

+4
source share
1 answer

Try adding TargetNullValue = '' to the binding, worked for me

  <telerik:RadNumericUpDown Value="{Binding Path=Contents, Mode=TwoWay, TargetNullValue=''}" IsEnabled="True" IsEditable="True" IsInteger="True" NullValue="" MinWidth="70" HorizontalAlignment="Left" HorizontalContentAlignment="Left" /> 
+7
source

Source: https://habr.com/ru/post/1497023/


All Articles