Number Formatting in UWP Numeric TextBox (SfNumericTextBox)

10 May 20213 minutes to read

Number formatting functionality allows formatting the text based on the FormatString of the control. The control will format the display text on lost focus.

Format String

The FormatString property determines the format specifier by which the display text has to be formatted.

Default Value of FormatString is N.

The following code sample shows how to display numeric text with currency format.

<Page xmlns:editors="using:Syncfusion.UI.Xaml.Controls.Input">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        <editors:SfNumericTextBox HorizontalAlignment="Center"


                               Width="200" x:Name="numericTextBox"




numericTextBox.FormatString = "C";
numericTextBox.FormatString = "C"

FormatString view


A detailed explanation of Numeric formatting is available here.
The result string produced by these format specifiers are influenced by the settings in the Regional Options control panel. Computers with different cultures or different numeric settings will generate different result strings.

Group separator modes

GroupSeparatorMode provides 2 states to display the group separator.
When the mode is set as Always, it will display separator while typing itself on the other hand when the mode is set as LostFocus it will enable the separator when the control lost its focus.


EnableGroupSeparator property must be enabled to use the GroupSeparatorMode.

<numeric:SfNumericTextBox Value="123456" FormatString="n" GroupSeparatorMode="Always"
SfNumericTextBox numericTextBox = new SfNumericTextBox();
            numericTextBox.Value = 123456;
            numericTextBox.FormatString = "n";
            numericTextBox.GroupSeparatorMode = GroupSeparatorMode.Always;
            numericTextBox.EnableGroupSeparator = true;
            this.Content = numericTextBox;

Display the value with enable group separator