Number Formatting in NumericUpDown (SfNumericUpDown)

14 Oct 20222 minutes to read

The Values of the SfNumericUpDown can be configured to display different formats like currency format, percent format etc.

Format String

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

NOTE

The control displays the formatted text on lost focus. Default Value of FormatString is ā€œnā€.

Display Currency Notation

c - Displays the value with currency notation.

numeric.FormatString="c";

Display Number Notation

n – Displays the value in number format.

numeric.FormatString="n";

Display Percentage Notation

p – Displays the value in Percentage.

numeric.FormatString="p";

NOTE

Instead of using above FormatString types, we can provide any symbol or value as string in FormatString property which will be appended with the value in SfNumericUpDown.

Xamarin.Android SfNumericUpDown percentage notation

Parser Input Value

The value of the SfNumericUpDown can be parsed based on the ParsingMode property.

NOTE

The ParsingMode is of type Parsers containing enum values of Double and Decimal. The default Value for ParsingMode is Double.

numeric.ParserMode=ParserMode.Decimal;

Xamarin.Android SfNumericUpDown parser mode

Compute to Percentage

The PercentDisplayMode property can be used to display numeric data in Percent mode.

NOTE

The control displays the percent value on lost focus.

It provides the following options

  • Value: Displays the value with percentage symbol.

    numeric.PercentDisplayMode=PercentDisplayMode.Value;
  • Compute: Displays the computed value with percentage symbol.

    numeric.PercentDisplayMode=PercentDisplayMode.Compute;

Xamarin.Android SfNumericUpDown compute to percentage