In SfDataGrid, you can display the double type values by using the GridNumericColumn. By default, it loads TextBlock in Display mode and SfNumericTextBox in Edit mode. You can format the value of the GridNumericColumn by using its FormatString inbuilt property.
SfDataGrid provides string format support in GridNumericColumn as follows,
With the help of the above string format, you can format the value of GridNumericColumn. You cannot explicitly specify the number of decimal places, decimal digits, group separator and group sizes in numeric value, when the above string format is specified on the GridNumericColumn’s FormatString property.
Note: In WPF, you can achieve the above scenario by using NumerDecimalDigits, NumberDecimalSeparator, NumberGroupSeparator and NumberGroupSizes properties.
The following screenshot displays the GridNumericColumn called “AnnualIncome”, loaded without specifying the FormatString property.
Figure 1 : Default view of the GridNumericColumn
The following code example illustrates how to load the above GridNumericColumn with Currency format by using the FormatString property.
The above currency format is applied to GridNumericColumn as shown in the following screenshot.
Figure 2 : GridNumericColumn with CurrencyFormat
When you want to display the value on GridNumericColumn by customizing its decimal places, decimal digits with the above currency format, you need to explicitly specify the format in FormatString property as shown in the following code example.
The above format is applied to the value of GridNumericColumn as shown in the following screenshot.
Figure 3: GridNumericColumn with specified numeic format
This page will automatically be redirected to the sign-in page in 10 seconds.