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
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
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.
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
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="")?
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
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
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
Is it in the schedule?
Is there workaround?
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,
Boyanthe Telerik team
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
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
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
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
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
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