Skip to main content
All docs
V23.2

DxTimeEditSettings.Format Property

Specifies the pattern used to format time editor values.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
[Parameter]
public string Format { get; set; }

Property Value

Type Default Description
String null

The format pattern. If it is not set, the long time format is applied.

Remarks

Use the Format property to format the time editor value when the editor is focused, and use the DisplayFormat to format the value when the editor is unfocused. If the DisplayFormat property is not set, the Format property affects both edit and display values.

Refer to the Standard Date and Time Format Strings and Custom Date and Time Format Strings help topics for more information about supported formats.

<DxGrid Data="@timetable" EditMode="GridEditMode.EditRow">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="ID" Visible="false" />
        <DxGridDataColumn FieldName="Nickname" />
        <DxGridDataColumn FieldName="StartTime">
            <EditSettings>
                <DxTimeEditSettings Format="h:mm"
                                    DisplayFormat="t" 
                                    MinTime="@MinTime" 
                                    MaxTime="@MaxStartTime" 
                                    OutOfRangeNotificationText="Game time can start from 9 am to 8 pm."
                                    ScrollPickerFormat="tt hh mm" />
            </EditSettings>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="EndTime" >
            <EditSettings>
                <DxTimeEditSettings Format="h:mm"
                                    DisplayFormat="t" 
                                    MinTime="@MinTime" 
                                    MaxTime="@MaxEndTime"
                                    OutOfRangeNotificationText="Game time can end from 9 am to 9 pm."
                                    ScrollPickerFormat="tt hh mm" />
            </EditSettings>
        </DxGridDataColumn>
    </Columns>
</DxGrid>

@code {
    Result[]? timetable;
    TimeSpan MinTime = new TimeSpan(09, 0, 0);
    TimeSpan MaxStartTime = new TimeSpan(20, 0, 0);
    TimeSpan MaxEndTime = new TimeSpan(21, 0, 0);

    protected override async Task OnInitializedAsync() {
        timetable = await TimeTable.GetData();
    }
}

Grid - Time Editor

To change the format at runtime, use the ITimeEditSettings.Format property instead.

Implements

See Also