Setting NumberFormatInfo in XAML

3 posts, 1 answers
  1. Greg
    Greg avatar
    23 posts
    Member since:
    Sep 2008

    Posted 07 May 2009 Link to this post

    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. Answer
    Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 08 May 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Greg
    Greg avatar
    23 posts
    Member since:
    Sep 2008

    Posted 08 May 2009 Link to this post

    Thanks. Works perfectly!
Back to Top