Question

We are using the Telerik RadNumericUpDown control (2013 version) in our application to display & edit both double values and integers; The control works fine for nullable double types: it displays nothing for a null value, and 0.00 for the 0 value. We want the same behaviour for integers, but the control always displays 0 for null values. I've tried setting the NullValue to an empty string & null, based on the discussion here: http://www.telerik.com/community/forums/silverlight/numericupdown/null.aspx, but this doesn't solve our issue.

The 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 nullable int.

Any help is appreciated.

Was it helpful?

Solution

Try adding to the binding TargetNullValue='', 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" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top