Represents a Binding converter that converts a source TimeSpan value to a phrase
(for example, 5 days 15 minutes), where the possible words are
weeks, days, hours, seconds, milliseconds and ticks.
Namespace:
C1.WPF.C1ScheduleAssembly: C1.WPF.C1Schedule (in C1.WPF.C1Schedule.dll)
Syntax
C# |
---|
[ValueConversionAttribute(typeof(TimeSpan), typeof(string))] public class TimeSpanWordingConverter : IValueConverter |
Visual Basic (Declaration) |
---|
<ValueConversionAttribute(GetType(TimeSpan), GetType(String))> _ Public Class TimeSpanWordingConverter _ Implements IValueConverter |
Remarks
The representing maximal, minimal and zero time measures may be defined in
the converter parameter. The general form of the parameter is 3 element array
of the TimePartsEnum type (or a string that lists enum members
separated by comma or semicolon). The treatment of the array elements is as follows:
- 0 - a maximal time measure
- 1 - a minimal time measure
- 2 - a zero time measure
A zero time measure is used to represent a time span that is less than a minimal integral span defined by the minimal measure. For example, if minimal measure is Second and zero measure is Minute that in the time span of 500 milliseconds (which is less than the one second) will be represented as "0 minutes" phrase.
There are also reduced forms of a parameter array.
2 items array:
- 0 - a maximal time measure
- 1 - a minimal time measure
- Zero time measure = minimal time measure.
1 item array:
- 0 - a minimal time measure
- Maximum time measure = Weeks
- Zero time measure = minimal time measure.
If the parameter is omitted, the following defaults are used:
- Maximum time measure = Weeks
- Minimal time measure = Zero time measure = Seconds