RibbonNumberBoxItemBuilder.Format(String) Method
In This Article
Specifies the item value’s display format and controls user input accordingly.
Namespace: DevExpress.AspNetCore.Office
Assembly: DevExpress.AspNetCore.Common.v24.2.dll
NuGet Package: DevExpress.AspNetCore.Common
#Declaration
C#
public RibbonNumberBoxItemBuilder Format(
string format
)
#Parameters
Name | Type | Description |
---|---|---|
format | String | The format. Default value: “text #0.#”. |
#Returns
Type | Description |
---|---|
Ribbon |
The number box item builder. |
#Remarks
The following numeric formats are available.
Show predefined formats
Format | Value | Formatted Value |
---|---|---|
“fixed |
100. |
100 |
“decimal” | 100. |
100. |
“percent” | 0. |
10% |
“currency” | 100. |
$100 |
var ribbonNumberBox = new DevExpress.RichEdit.RibbonNumberBoxItem();
ribbonNumberBox.format = 'currency';
Show custom formats
A custom format is a string that contains wildcard characters. The table below list the supported characters:
Character | Description |
---|---|
0 | A digit. Displays ‘0’ if it is not specified in the UI. |
# | A digit or nothing. One symbol can denote several integer digits, but only one decimal digit. |
. | A decimal separator. Displayed according to the specified locale. |
, | A group separator. Displayed according to the specified locale. |
% | The percent sign. Multiplies the input value by 100. |
; | Separates formats for positive and negative values. |
Other characters | Any character. Should be placed only at the format string’s beginning or end. |
Enclose a wildcard character in single quotes (‘%’) to add this sign to the input value.
The table below demonstrates how you can format numeric values.
Format | Value | Formatted Value |
---|---|---|
“$ #,##0.##” | 14500. |
$ 14,500. |
“$ #,##0.##;($ #,##0.##)” | -2314. 2314. |
($ 2,314. $ 2,314. |
“#0%” | 0. |
15% |
“#,##0. |
13415. |
13,415. |
“#0.## kg” | 3. |
3. |
See Also