Skip to main content
All docs
V25.1
  • 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.v25.1.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