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

Setting NumberFormatInfo in XAML

2 Answers 342 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 2
Greg asked on 07 May 2009, 06:04 PM
Can the NumberFormatInfo values (e.g. NumberDecimalDigits) be set in XAML or must they be set in the code behind? The OnLine help only gives examples using code behind.

2 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Petkov
Telerik team
answered on 08 May 2009, 08:11 AM
Hi Greg,

Here is an example you can use:

<Window x:Class="NumericUpDown.NumericWindow" 
    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:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" 
    Title="NumericTestWindow" Height="300" Width="300"
    <Window.Resources>   
        <globalization:NumberFormatInfo x:Key="numberFormatInfo" NumberDecimalDigits="0" /> 
    </Window.Resources> 
 
    <Grid x:Name="LayoutRoot" Background="White"
        <telerik:RadNumericUpDown x:Name="Numeric1" ValueFormat="Numeric" Height="25" Width="100" 
            SmallChange="1" NumberFormatInfo="{StaticResource numberFormatInfo}" Maximum="10" Value="5" /> 
    </Grid> 
</Window> 

Sincerely yours,
Konstantin Petkov
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.
0
Greg
Top achievements
Rank 2
answered on 08 May 2009, 03:32 PM
Thanks. Works perfectly!
Tags
NumericUpDown
Asked by
Greg
Top achievements
Rank 2
Answers by
Konstantin Petkov
Telerik team
Greg
Top achievements
Rank 2
Share this question
or