In This Article

TimeSpanEditBox

The TimeSpanEditBox control allows for the input of a TimeSpan (days, hours, minutes, seconds, milliseconds) value. It uses the TimeSpanPicker control in its popup.

Screenshot

Common Capabilities

Each of the features listed in the table below describe functionality that is common to most edit boxes. Please see the Edit Box Basics topic for details on each of these options and how to set them.

Feature Description
Has a spinner Yes, and can be hidden or optionally displayed only when the control is active.
Has a popup Yes, and can be hidden or its picker appearance customized.
Null value allowed Yes, and can be prevented.
Read-only mode supported Yes.
Non-editable mode supported Yes.
Has multiple parts Yes, and supports optional arrow key navigation.
Placeholder text supported Yes, and overlays the control.
Header content supported Yes, and appears above the control.
Default spin behavior Wrap.

Formats

Standard timespan formats are supported via the Format property and affect the textual value display. These formats are recommended:

  • "c"
  • "g"
  • "G"
Note

If a custom timespan format is used instead of a standard timespan format, the format should begin with a + (plus sign) to indicate that negative timespans are supported. If a custom timespan format does not begin with a plus sign, then the Minimum property should be set to a zero or higher timespan value.

Minimum and Maximum Values

Minimum and maximum values may be assigned via the Maximum and Minimum properties.

No values can be committed that lay outside of the inclusive range created by those properties.

Parts and Incrementing/Decrementing

This edit box has multiple parts:

  • Days
  • Hours
  • Minutes
  • Seconds
  • Milliseconds

When the caret is over a part, the part value may be incremented or decremented. Please see the Edit Box Basics topic for information on how to do this.

Small value changes alter the current number component by 1, which is the default for the SmallChange property. Large value changes alter the current number component by other amounts, based on the LargeChange property.

The DefaultValue property sets the value that will be set when incrementing or decrementing from a null value.

Sample XAML

This control can be placed within any other XAML container control, such as a Page or Panel with this sort of XAML:

<editors:TimeSpanEditBox Value="{Binding Path=YourVMProperty, Mode=TwoWay}" />