At this point I setting decimal places to 0 in code behind, but it would be preferable to set this in XAML
Mike
28 Answers, 1 is accepted
At the moment, Silverlight XAML parser throws an exception when trying to create NumberFormatInfo in XAML. We reported this to Microsoft.
When this is fixed, you will be able to set NumberFormatInfo in XAML in two ways:
1. Create NumberFormatInfo in page resources and reference it as a static resource:
<UserControl x:Class="SilverlightNumericTest.Page" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib" |
xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"> |
<UserControl.Resources> |
<globalization:NumberFormatInfo x:Key="numberFormatInfo" NumberDecimalDigits="0"/> |
</UserControl.Resources> |
<Grid x:Name="LayoutRoot" Background="White"> |
<telerikInput:RadNumericUpDown ValueFormat="Numeric" NumberFormatInfo="{StaticResource numberFormatInfo}"/> |
</Grid> |
</UserControl> |
2. Create NumberFormatInfo and set it as an element value, like:
<UserControl x:Class="SilverlightNumericTest.Page" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib" |
xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"> |
<Grid x:Name="LayoutRoot" Background="White"> |
<telerikInput:RadNumericUpDown ValueFormat="Numeric"> |
<telerikInput:RadNumericUpDown.NumberFormatInfo> |
<globalization:NumberFormatInfo NumberDecimalDigits="0"/> |
</telerikInput:RadNumericUpDown.NumberFormatInfo> |
</telerikInput:RadNumericUpDown> |
</Grid> |
</UserControl> |
Greetings,
Hristo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
<UserControl.Resources>
<globalization:NumberFormatInfo x:Key="numberFormatInfo" NumberDecimalDigits="0"/>
</UserControl.Resources>
<telerik:RadNumericUpDown VerticalAlignment="Center" NumberFormatInfo="{StaticResource numberFormatInfo}" x:Name="TextBoxMonthsFreeOutsideTerm" Height="25" Width="50" LargeChange="1" SmallChange="1" Minimum="0" Maximum="12" ValueFormat="Numeric" />
This gives me AG_E_PARSER_BAD_TYPE at runtime. If I remove the NumberFormatInfo property from the control, everything works.
Are there plans to fix the bug anytime soon?
This is problem of Silverlight 2 XAML Parser. Not a RadNumericUpDown bug. So we will have to wait for the next Silverlight version and hope that this will be fixed.
Sincerely yours,
Hristo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
is this issue fixed by microsoft?
any updates available.
regards,
dencil.
It is still not fixed, maybe it will be available in Silverlight 3 but I am not exactly sure. For the time being it can only be set through code.
Regards,
Boyan
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
System.Globalization.NumberFormatInfo objFormat = new System.Globalization.NumberFormatInfo();
objFormat.NumberDecimalDigits = 0;
numericIntUpDownFrom.NumberFormatInfo = objFormat;
However, the arrows of this control don't work at all in this case.
Any ideas?
Thanks in advance
The NumberFormatInfo property is already instantiated and thus you don't have to assign new value to it, rather you should just change the
numericIntUpDownFrom.NumberFormatInfo.NumberDecimalDigits = 0;
value. If you still experience problems using the NumberFormatInfo please feel free to contact us.
Kind regards,
Hristo Borisov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I am really sorry for the late response. Would you make sure that you have set SmallIncrement to have value bigger than 1, so you can actually see that the value of the control is changing. In case it's set to 0.1 and you are rounding the value to 0 decimal places, there is no way you can anticipate any difference while clicking the arrows.
Sincerely yours,
Hristo Borisov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I have 2 RadNumericUpDown in my code and when I set NumberDecimalDigits = 0 to one of them and then set NumberDecimalDigits = 2 to the second control, the first control also presents 2 decimal digits.
The reply above talks about SmallIncrement but there is no such property. Assuming this was meant to say SmallChange this makes no difference.
I have a control on a page with the following style applied:
<Style x:Key="NumericUpDownStyle" TargetType="tki:RadNumericUpDown">
<Setter Property="IsEditable" Value="True" />
<Setter Property="ValueFormat" Value="Currency" />
<Setter Property="Minimum" Value="10000" />
<Setter Property="Maximum" Value="999999999" />
<Setter Property="MaxHeight" Value="20" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
The control itself is defined as follows:
<tki:RadNumericUpDown Grid.Row="1" Grid.Column="5" x:Name="RetirementIncomeUpDown" SmallChange="5000" LargeChange="10000" Style="{StaticResource NumericUpDownStyle}">
</tki:RadNumericUpDown>
Code behind sets the number of decimal places to 0:
var ud = (RadNumericUpDown)this.LayoutRoot.FindName("RetirementIncomeUpDown");
if (ud != null)
ud.NumberFormatInfo.CurrencyDecimalDigits = 0;
If I remove the code behind that sets the number of decimal digits the arrows are still broken. If I amend the range of values to more closely resemble those shown in the demo the down arrow works fine but the up arrow only works if I start with a negative value and even then only works up to the point the value reaches 0 (despite a maximum value of 100 being specified as allowable)
I'm very disappointed that what seemed like a fairly basic control (a) can't be initialised correctly in XAML to have no decimal places and (b) exhibits unpredictable behaviour when the arrow keys are used even when the decimal places are left to default to two places.
Are there any plans to supply fixes for these issues? On top of other issues (no documentation for some controls, limited functionality of the charting control, lack of support for anything other than images in the CoverFlow control etc) it is proving to be very hard to justify purchase of this set of controls once our trial evaluation period has expired, given our experience to date :-(
Unfortunately both of these problems are part of the Silverlight framework. Creating your own style and setting it to a multiple numeric controls is a good practice to the extent that you save code. Unfortunately, the RangeBase class provided by the Silverlight Framework seems to have some problems with its coercing of Minimum and Maximum values when set in Style. I managed to reproduce your scenario and I noticed that if I set the Maximum property before the Minimum in the Style, the control works fine. To further prove my logic that the problem comes from the RangeBase class I created the same Style but for another control that also uses RangeBase - RadSlider. Declaring the Minimum property setter prior to the Maximum yields the same result - the RadSlider doesn't response to changing its value. That is a pity as I tested the issue in the Silverlight 3 implementation of RangeBase which appears to have the same problem.
What I would recommend is not to use Style, which will make your code a little bit more redundant, but will work correctly. For our next release we are planning to introduce our own RangeBase class that couples with generic types and hopefully doesn't introduce the same bugs as the Microsoft's one does.
Changing the NumberFormatInfo in xaml is still out of around hands. We will try to improve this formatting logic for our next release, and test whether an alternative one is required.
We pretty much understand the problem of not having a complete documentation at the moment, considering the load of support we experience. Improving our documentation is our next strategic goal. We will focus on gradually improving our documentation and online examples in order to meet the desired quality standards. I am sure you understand the trade-off between top-notch functionality and comprehensive documentation that requires extensive up to date revisions.
About the limitation of using only images in the CoverFlow. Silverlight 2, doesn't support perspective 3D transformation that will allow us to render any UI Element in perspective view. Fortunately, Silverlight 3 does support such transformation and the Silverlight team will stretch the framework capabilities to its maximum to deliver rich and reliable set of controls.
What I can say is that all of your experience is limited to the Silverlight itself instead of our controls. Microsoft has several essential cornerstones to achieve which are coming very soon. I hope this will answer some of your concerns and will help you make your final say in purchasing our controls. Stay tuned for the upcoming releases and always feel free to contact us for further assistance.
Greetings,
Hristo Borisov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Touch wood, your suggested workaround - removing any Style declaration for the control and specifying Maximum before Minimum appears to work.
My frustration around documentation is compounded by the fact that the demos are often incomplete (or contain references to external files we don't have access to) and important controls are completely missing from the documentation so that there is only the demo to go by. In addition the documentation is extremely inconsistent eg One control will have a page describing the available events, another control won't.
As Hristo said we realize that our documentation is not as full and consistent as we want it to be. But we are trying to balance between new list of features and controls exceeding that of the competitors and because of this, sometimes our documentation is suffering. We understand that in the moment this is our weakness but I assure you that we will do our best to reach the quality of documentation of our ASP.NET controls.
Kind regards,
Boyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
The type 'NumberFormatInfo' was not found because 'clr-namespace:System.Globalization;assembly=mscorlib' is an unknown namespace.
Version 2010.1.422.1040
Any ideas?
Thanks, Alex.
I really love most of your work, but sometimes I just don't understand.
Just add something like the DecimalPlaces property on the Microsoft SL4 NumericUpDown and be done with it. This is such a basic and expected feature of this control that I can't believe you didn't fix this a LONG time ago.
I have added this request in PITS. You can view it here. You can vote for it, track its status and see when it is going to be implemented.
If you have any other concerns about our controls please feel free to contact us again.
Sincerely yours,
Konstantina
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.
Thank you for contacting us.
We will consider including such a property after the official release of Q2 2010, probably for the service pack due in few week after that. Hope this time frame is acceptable for you.
If you have any other concerns about our controls please feel free to contact us again.
All the best,
Konstantina
the Telerik team
Could you please specify which coma you want to remove. You can change all separators in the following way:
numeric.NumberFormatInfo=
new
NumberFormatInfo();
numeric
.NumberFormatInfo.NumberDecimalSeparator =
"."
;
numeric
.NumberFormatInfo.NumberGroupSeparator =
""
;
The second row changes the decimal separator and the third one removes the group separator. Hope this helps.
Regards,
Boyan
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I have added a feature request in PiTS. You can follow its progress here.
Regards,
Boyan
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Issue 2375 is targetting just the NumberDecimalDigits and have a separate property-- NumberDecimalDigits that you can set in the XAML and that is why it is resolved. However you still can't set
NumberFormatInfo in XAML hence you can't change the decimal separator and that is why issue 8314 is entered.
Best wishes,
Boyan
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>