DxComboBox<TData, TValue>.EditFormat Property
Specifies the pattern used to format an editor’s value.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v20.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public string EditFormat { get; set; }
Property Value
Type | Description |
---|---|
String | The format pattern. |
Remarks
Use the EditFormat property to format an editor’s value when the editor is focused.
Note
To format the ComboBox’s display value when the editor is not focused, use the DisplayFormat property.
The EditFormat property allows you to format values displayed in one-column and multi-column ComboBoxes.
Format a One-Column ComboBox
The code below applies the following formats to the ComboBox editor:
- The currency format to numeric display values.
- The fixed-point format to numeric edit values.
<DxComboBox Data="@Prices"
@bind-Value="@CurrentPrice"
EditFormat="F"
DisplayFormat="C">
</DxComboBox>
@code {
IEnumerable<string> Prices = new List<string>() {
"20.5",
"25",
"50",
};
string CurrentPrice { get; set; }
}
Format a Multi-Column ComboBox
The code below adds three columns to a ComboBox and applies the {1} {2}
format to the component’s edit values. This format specifies that the editor value includes values of the Name (VisibleIndex = 1
) and Surname (VisibleIndex = 2
) columns.
Note
When you enable filter mode for a multi-column ComboBox, the filter only takes into account data of the columns that are used in the editor’s format pattern.
<DxComboBox Data="@Staff.DataSource"
@bind-Value="@SelectedPerson"
EditFormat ="{1} {2}">
<DxListEditorColumn FieldName="Id" Width="50px" />
<DxListEditorColumn FieldName="FirstName" Caption="Name"/>
<DxListEditorColumn FieldName="LastName" Caption="Surname"/>
</DxComboBox>
@code {
Person SelectedPerson { get; set; } = Staff.DataSource[0];
}
If the EditFormat property’s value is not specified, an editor’s value text is controlled by the TextFieldName property.