Skip to main content
All docs
V24.2

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

DateEdit.DefaultTime Property

Gets or sets the value displayed in the empty editor when a user starts to enter time. This property is in effect only if the editor operates TimeOnly data. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v24.2.dll

NuGet Package: DevExpress.Wpf.Core

#Declaration

public TimeOnly? DefaultTime { get; set; }

#Property Value

Type Default Description
Nullable<TimeOnly> TimeOnly.MinValue

The value displayed in the empty editor when a user starts to enter data.

#Remarks

If the editor’s value is not set, the editor displays the DefaultTime when a user opens the drop-down time picker.

The DefaultDate property does not affect the value that the empty editor returns. Use the BaseEdit.NullValue property to specify the editor value when its value is null.

For more information about DateOnly and TimeOnly support in the DateEdit control, refer to the following section: Interact with DateOnly and TimeOnly Data.

#Example: Use Spin Buttons to Edit a TimeOnly Value

The following code snippet allows users to press spin buttons to increase or decrease a TimeOnly value:

DevExpress Editors for WPF - Edit a TimeOnly value using spin buttons

<dxe:DateEdit MaskType="TimeOnly" AllowDefaultButton="False" 
              PopupOpening="DateEdit_PopupOpening" 
              DefaultTime="10:30" MinTime="7:30">
    <dxe:ButtonEdit.Buttons>
        <dxe:SpinButtonInfo SpinDownClick="SpinButtonInfo_SpinDownClick"
                            SpinUpClick="SpinButtonInfo_SpinUpClick"/>
    </dxe:ButtonEdit.Buttons>
</dxe:DateEdit>
void SpinButtonInfo_SpinDownClick(object sender, RoutedEventArgs e) {
    ((ButtonEdit)BaseEdit.GetOwnerEdit((SpinButton)sender)).SpinDown();
}
void SpinButtonInfo_SpinUpClick(object sender, RoutedEventArgs e) {
    ((ButtonEdit)BaseEdit.GetOwnerEdit((SpinButton)sender)).SpinUp();
}
private void DateEdit_PopupOpening(object sender, OpenPopupEventArgs e) {
    e.Cancel = true;
}
See Also