Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxTimeEdit<T>.DisplayFormat Property

Specifies the pattern used to format the Time Edit’s display value when the editor is not focused.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue("")]
[Parameter]
public string DisplayFormat { get; set; }

#Property Value

Type Default Description
String String.Empty

The format pattern.

#Remarks

Use the DisplayFormat property to format the Time Edit’s display value when the editor is not focused, and use Format property to format the editor’s value in edit mode when the editor is focused. If the DisplayFormat property is not set, the Format is applied in display and edit modes.

See the Standard Date and Time Format Strings and Custom Date and Time Format Strings MSDN articles for more information about supported formats.

The following example applies the a 12-hour clock format in display mode and the a 24-hour clock format in edit mode:

Razor
<DxTimeEdit @bind-Time="@TimeValue"
            Format="HH:mm"
            DisplayFormat="@DisplayFormat"></DxTimeEdit>

@code {
    TimeSpan TimeValue { get; set; } = DateTime.Now.TimeOfDay;
    string DisplayFormat { get; } = string.IsNullOrEmpty(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.AMDesignator) ? "HH:mm" : "h:mm tt";
}

Run Demo: Time Edit - Display Format

See Also