This is a migrated thread and some comments may be shown as answers.

NullValue is not set to textbox when RadNumericUpDown is loaded

15 Answers 629 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Elifbars
Top achievements
Rank 1
Elifbars asked on 05 Aug 2010, 01:41 PM
Hello,

It's me again =)
I have a question about NullValue property:
Here is my numericUpDown control code:
As you see i want RadNumericUpDown to show nothing in it's textbox when it's binding value is null. But when the the userControl with this numericUpDown is loaded i see the value $0.00 in it's textbox instead of "empty" string.

<telerik:RadNumericUpDown Name="numericVMDNQRS"
            NullValue="" Value="{Binding Path=Tier.VMDNQRS,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
            IsEditable="True" AutoReverse="False" Minimum="0"          
            SmallChange="0.1"
            LargeChange="1" V
            alueFormat="Percentage"
            DataContext="{Binding}"/>


When i delete everything from textbox and it loses focus everything works well: no value appears in textbox.
I tried to check Value property of RadNumericUpDown on Initialized and Loaded event - it's not null but 0.0.
I also tried to inherit from RadNumericUpDown and override FormatDisplay mehtod to check the value that it get from argument, but it's also 0.0.
So the question is how to show nothing in RadNumericUpDown textbox when it has just loaded and it's binding value is null?

15 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 10 Aug 2010, 11:36 AM
Hello Elifbars,

I was unable to reproduce the problem with a simple application. Could you please, verify that your data objects' property that is bound to RadNumericUpDown is nullable? A sample application that could be used to observe the problem would be of great help, though.

Greetings,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Elifbars
Top achievements
Rank 1
answered on 16 Aug 2010, 08:20 PM
Hello,

This post is not the answer on my previous quiestion but it may help while working with RadNumericUpDown.
I wrote it here by accident, because didn't notice that in my previous post property IsEditable was set to True, but now i can't delete it.
Maybe it will be better to replace this post to another thread. Sorry.

I have another RadNumericUpDown
<telerik:RadNumericUpDown Name="numericMinutes"
                        IsEnabled="{Binding ElementName=chkAutoBatch,Path=IsChecked}"
                        IsEditable="False" Width="60"
                        Value="{Binding Path=AutoBatchTimeMinutes,Mode=TwoWay}"
                        Minimum="0" Maximum="50" SmallChange="10" LargeChange="10"
                        AutoReverse="True"
                        IsInteger="True" ValueFormat="Numeric"/>

The problem was that after loading it's value was always 0, even i had changed it's value before.

Solution:
As you can see IsEditable is set to False. After I set IsEditable to True it's value binding started to work as it should. So the problem was in property IsEditable=False which prohibits to change RadNumericUpDown value when it loads.

What concerns NullValue, so i didn't check it's behaviour because now i don't need logic with NullValue in my application.
0
Boyan
Telerik team
answered on 19 Aug 2010, 03:10 PM
Hello Elifbars,

This is a known problem and it is already resolved. You should download the latest version of our controls (SP1). Here is the link to the fixed bug in PITS: http://www.telerik.com/support/pits.aspx#/public/silverlight/1645

Sorry for the caused inconvenience, let me know if you have further questions.

All the best,
Boyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Elifbars
Top achievements
Rank 1
answered on 01 Sep 2010, 02:03 PM
Hi, Boyan 
You replied: "This is a known problem and it is already resolved."

Do you mean problem when after loading value is always 0 if IsEditable=False or NullValue issue (when the value of NumericUpDown is 0.0 even binding value is null and NullValue="")?
0
Accepted
Boyan
Telerik team
answered on 06 Sep 2010, 02:10 PM
Hello Elifbars,

Both problems should be fixed now. However if you still have problems with the latest version please let us know. We will be glad to help.

Sincerely yours,
Boyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Saulius Kundrotas
Top achievements
Rank 1
answered on 07 Oct 2010, 02:08 PM
When Min property is specified in xaml - binding to Value is ignored in latest WPF controls? I see bug was fixed in silverlight controls but it seems not fixed for WPF control? My properties specified on control -

IsEditable

 

 

="True" IsInteger="True" ValueFormat="Numeric" Maximum="400" Minimum="10" SmallChange="5"

 

and binding to Value property. Control resides in DataTemplate and DataTemplate is used to render ViewModel.

Thanks
0
Boyan
Telerik team
answered on 13 Oct 2010, 09:42 AM
Hi Saulius Kundrotas,


Sorry for the late reply. We managed to reproduce the issue. It is very strange that if the numeric is not in DataTemplate the binding is working fine. Also if the Minimum is a negative value  binding is working fine as well. But in your scenario it is not. I have entered this bug in our Public issue tracking system. You can follow the PITS Issue progress by its ID: 3711

Thank you for your report. I have updated your Telerik points.

All the best,
Boyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 09 Nov 2010, 06:20 PM
I couldn't locate this issue regarding the Minimum property causing the control not to bind in the PITS.

Is it in the schedule?

Is there workaround?
0
Boyan
Telerik team
answered on 12 Nov 2010, 09:30 AM
Hello Mark,

Sorry I have given you a wrong link. This is the link to the entry in PITS: http://www.telerik.com/support/pits.aspx#/public/wpf/3711. As a workaround you can just not use a DataTemplate.

Don't hesitate to contact us if you have further questions.

Sincerely yours,

Boyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 12 Nov 2010, 02:21 PM
Thanks. I can see it is not scheduled for Q3.  This should be an easy fix on your end.  It seems like a typo.  Can it be worked into Q3?

My design is heavily dependent on data templates.  This pretty much makes the control unusable for any enterprise app requiring a minimum bound > 0.

Any other workaround?

Mark
0
Boyan
Telerik team
answered on 17 Nov 2010, 06:06 PM
Hi Mark,

  This fix didn't make it for the Q3 release. We investigated it We will do our best to fix it for next week's internal build. Hope this is acceptable for you.

Sorry for the inconvenience caused. Let me know if you have further questions.

Sincerely yours,
Boyan
the Telerik team
See What's New in RadControls for WPF in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Biff
Top achievements
Rank 1
answered on 29 Mar 2016, 07:13 PM

Hello,

I think this is related. I have a RadNumericUpDown with currency and a Viewmodel binding. The currency property is bound to a nullable decimal value. When the view intializes with a null decimal, nothing is displayed, which is correct. If there is already a decimal value, i cannot seem to remove the value (remove all text in the input). No matter how i try to delete the value, the value remains the same as soon as the RadNumericUpDown looses focus. I have the same setup for a nullable double property that is also bound to a RadNumericUpDown, which works fine when deleting the value (making it null in the viewmodel)

Here is my ViewModel property that i bind the RadNumericUpDown control to:

 

private decimal? currencyValue;

        public decimal? CurrencyValue
        {
            get { return currencyValue; }
            set {
                currencyValue = value;RaisePropertyChanged("CurrencyValue");
            }
        }

View:

<telerik:RadNumericUpDown x:Name="currencyWidget" ValueFormat="Currency" Value="{Binding CurrencyValue}" NullValue="" />

Any help would be greatly appreciated,

Biff

0
Yana
Telerik team
answered on 30 Mar 2016, 11:40 AM
Hi Biff,

I have tested the explained scenario, but wasn't able to reproduce the issue  - I was able to delete the value inside NumericUpDown without a problem. Is it possible for you to send us a small runnable demo where the issue can be replicated? Please note that you should open a support ticket and attach it there.

Thanks in advance.

Regards,
Yana
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Arif
Top achievements
Rank 1
answered on 22 Feb 2018, 10:22 AM

seems a long time to reply on this thread. However i am facing a similar issue with NumericUpDown Control

when i press backspace to clear the value i get validation exception however the property setter is not called. following is the xaml for the control i am using. i am expecting that in case of binding failure fallback value will be set on the binding property.

<telerik:RadNumericUpDown Value="{Binding Trace, Mode=TwoWay, FallbackValue={x:Static system:Double.NaN}}"
                                  IsInteger="False"
                                  UpdateValueEvent="PropertyChanged"
                                  IsEditable="True"
                                  ValueFormat="Numeric"
                                  HorizontalAlignment="Center" VerticalAlignment="Center"/>

 

 

my objective is to validate the viewmodel and disable the action button on the control. however this behavior causes the numericuipdown to display the redbox but validation doesn't happen and action button remains enabled.

 

would appreciate any help

 

Thanks

0
Dilyan Traykov
Telerik team
answered on 26 Feb 2018, 12:25 PM
Hello Arif,

Please note that this result is expected and can be observed when replacing the RadNumericUpDown with a standard MS TextBox. You can refer to this forum thread which discusses a similar issue.

What I can suggest in this case is to define the following converter for your binding:

public class MyConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value == null)
        {
            return Double.NaN;
        }
 
        return value;
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value == null)
        {
            return Double.NaN;
        }
 
        return value;
    }
}

Please let me know whether such an approach would work for you.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
NumericUpDown
Asked by
Elifbars
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Elifbars
Top achievements
Rank 1
Boyan
Telerik team
Saulius Kundrotas
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Biff
Top achievements
Rank 1
Yana
Telerik team
Arif
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or