RibbonNumberBoxItemBuilder.Format(String) Method
Specifies the item value’s display format and controls user input accordingly.
Namespace: DevExpress.AspNetCore.Office
Assembly: DevExpress.AspNetCore.Common.v25.1.dll
NuGet Package: DevExpress.AspNetCore.Common
Declaration
public RibbonNumberBoxItemBuilder Format(
string format
)
Parameters
| Name | Type | Description |
|---|---|---|
| format | String | The format. Default value: “text #0.#”. |
Returns
| Type | Description |
|---|---|
| RibbonNumberBoxItemBuilder | The number box item builder. |
Remarks
The following numeric formats are available.
Show predefined formats
| Format | Value | Formatted Value |
|---|---|---|
| “fixedPoint” | 100.11 | 100 |
| “decimal” | 100.11 | 100.11 |
| “percent” | 0.1011 | 10% |
| “currency” | 100.11 | $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.55 | $ 14,500.55 |
| “$ #,##0.##;($ #,##0.##)” | -2314.12 2314.12 |
($ 2,314.12) $ 2,314.12 |
| “#0%” | 0.15 | 15% |
| “#,##0.00” | 13415.24 | 13,415.24 |
| “#0.## kg” | 3.14 | 3.14 kg |
See Also