Class TimeUpDown
Represents a control that uses a spinner and textbox to allow a user to input time.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.Input.Toolkit.dll
Syntax
[TemplatePart(Name = "Text", Type = typeof(TextBox))]
[TemplatePart(Name = "Spinner", Type = typeof(Spinner))]
[TemplatePart(Name = "TimeHintPopup", Type = typeof(Popup))]
[StyleTypedProperty(Property = "SpinnerStyle", StyleTargetType = typeof(ButtonSpinner))]
public class TimeUpDown : UpDownBase<DateTime?>, IControl, IFrameworkElement, IUIElement, IDependencyObject
Remarks
TimeInput supports only the following formatting characters: 'h', 'm', 's', 'H', 't'. All other characters are filtered out: 'd', 'f', 'F', 'g', 'K', 'M', 'y', 'z'.
Constructors
| Improve this Doc View SourceTimeUpDown()
Initializes a new instance of the TimeUpDown class.
Declaration
public TimeUpDown()
Fields
| Improve this Doc View SourceCultureProperty
Identifies the Culture dependency property.
Declaration
public static readonly DependencyProperty CultureProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
FormatProperty
Identifies the Format dependency property.
Declaration
public static readonly DependencyProperty FormatProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsCyclicProperty
Identifies the IsCyclic dependency property.
Declaration
public static readonly DependencyProperty IsCyclicProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
MaximumProperty
Identifies the Maximum dependency property.
Declaration
public static readonly DependencyProperty MaximumProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
MinimumProperty
Identifies the Minimum dependency property.
Declaration
public static readonly DependencyProperty MinimumProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TimeGlobalizationInfoProperty
Identifies the TimeGlobalizationInfo dependency property.
Declaration
public static readonly DependencyProperty TimeGlobalizationInfoProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TimeHintContentProperty
Identifies the TimeHintContent dependency property.
Declaration
public static readonly DependencyProperty TimeHintContentProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TimeParsersProperty
Identifies the TimeParsers dependency property.
Declaration
public static readonly DependencyProperty TimeParsersProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceActualCulture
Gets the actual culture used by the control for formatting and parsing.
Declaration
public CultureInfo ActualCulture { get; }
Property Value
Type | Description |
---|---|
System.Globalization.CultureInfo | The actual culture. |
ActualFormat
Gets the actual format that will be used to display Time in the TimeUpDown. If no format is specified, ShortTimeFormat is used.
Declaration
public ITimeFormat ActualFormat { get; }
Property Value
Type | Description |
---|---|
ITimeFormat | The actual display format. |
ActualTimeGlobalizationInfo
Gets the actual TimeGlobalization info used by the control.
Declaration
public TimeGlobalizationInfo ActualTimeGlobalizationInfo { get; }
Property Value
Type | Description |
---|---|
TimeGlobalizationInfo |
Remarks
If TimeGlobalizationInfo is not set, will return default TimeGlobalizationInfo instance.
ActualTimeParsers
Gets the actual TimeParsers that will be used for parsing by the control.
Declaration
public TimeParserCollection ActualTimeParsers { get; }
Property Value
Type | Description |
---|---|
TimeParserCollection |
Remarks
Includes the TimeParsers introduced in the TimeGlobalizationInfo.
Culture
Gets or sets the culture that will be used by the control for parsing and formatting.
Declaration
public CultureInfo Culture { get; set; }
Property Value
Type | Description |
---|---|
System.Globalization.CultureInfo |
Format
Gets or sets the Format used by the control. From XAML Use either "Short", "Long" or a custom format. Custom formats can only contain "H", "h", "m", "s" or "t". For example: use 'hh:mm:ss' is used to format time as "13:45:30".
Declaration
[TypeConverter(typeof(TimeFormatConverter))]
public ITimeFormat Format { get; set; }
Property Value
Type | Description |
---|---|
ITimeFormat |
IsCyclic
Gets or sets a value indicating whether the TimeUpDown control will cycle through values when trying to spin the first and last item.
Declaration
public bool IsCyclic { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Maximum
Gets or sets the maximum time considered valid by the control.
Declaration
[TypeConverter(typeof(TimeTypeConverter))]
public DateTime? Maximum { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Remarks
Setting the Maximum property is applicable for the following features: Parsing a new value from the textbox, spinning a new value and programmatically specifying a value.
Minimum
Gets or sets the minimum time considered valid by the control.
Declaration
[TypeConverter(typeof(TimeTypeConverter))]
public DateTime? Minimum { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Remarks
Setting the minimum property is applicable for the following features: Parsing a new value from the textbox, spinning a new value and programmatically specifying a value.
TimeGlobalizationInfo
Gets or sets the strategy object that determines how the control interacts with DateTime and CultureInfo.
Declaration
public TimeGlobalizationInfo TimeGlobalizationInfo { get; set; }
Property Value
Type | Description |
---|---|
TimeGlobalizationInfo |
TimeHintContent
Gets the text used to guide the user when entering time.
Declaration
public object TimeHintContent { get; }
Property Value
Type | Description |
---|---|
System.Object |
TimeParsers
Gets or sets a collection of TimeParsers that are used when parsing text to time.
Declaration
public TimeParserCollection TimeParsers { get; set; }
Property Value
Type | Description |
---|---|
TimeParserCollection |
Value
Gets or sets the currently selected time.
Declaration
[TypeConverter(typeof(TimeTypeConverter))]
public override DateTime? Value { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Overrides
Methods
| Improve this Doc View SourceFormatValue()
Renders the value property into the textbox text.
Declaration
protected override string FormatValue()
Returns
Type | Description |
---|---|
System.String | Formatted Value. |
Overrides
OnApplyTemplate()
Builds the visual tree for the TimeUpDown control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
OnCreateAutomationPeer()
When implemented in a derived class, returns class-specific AutomationPeer implementations for the Silverlight automation infrastructure.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer | The class-specific AutomationPeer subclass to return. |
Overrides
| Improve this Doc View SourceOnDecrement()
Called by OnSpin when the spin direction is SpinDirection.Decrease.
Declaration
protected override void OnDecrement()
Overrides
OnGotFocus(RoutedEventArgs)
Provides handling for the GotFocus event.
Declaration
protected override void OnGotFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnIncrement()
Called by OnSpin when the spin direction is SpinDirection.Increase.
Declaration
protected override void OnIncrement()
Overrides
OnKeyDown(KeyEventArgs)
Provides handling for the KeyDown event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | e | Key event args. |
Overrides
Remarks
Only support up and down arrow keys.
OnLostFocus(RoutedEventArgs)
Provides handling for the LostFocus event.
Declaration
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMaximumChanged(Nullable<DateTime>, Nullable<DateTime>)
Called when the Maximum property value has changed.
Declaration
protected virtual void OnMaximumChanged(DateTime? oldValue, DateTime? newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.DateTime> | oldValue | Old value of the Maximum property. |
System.Nullable<System.DateTime> | newValue | New value of the Maximum property. |
OnMinimumChanged(Nullable<DateTime>, Nullable<DateTime>)
Called when the Minimum property value has changed.
Declaration
protected virtual void OnMinimumChanged(DateTime? oldValue, DateTime? newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.DateTime> | oldValue | Old value of the Minimum property. |
System.Nullable<System.DateTime> | newValue | New value of the Minimum property. |
OnMouseEnter(MouseEventArgs)
Provides handling for the MouseEnter event.
Declaration
protected override void OnMouseEnter(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMouseLeave(MouseEventArgs)
Provides handling for the MouseLeave event.
Declaration
protected override void OnMouseLeave(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMouseLeftButtonDown(MouseButtonEventArgs)
Provides handling for the MouseLeftButtonDown event.
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMouseLeftButtonUp(MouseButtonEventArgs)
Called before the MouseLeftButtonUp event occurs.
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnValueChanged(RoutedPropertyChangedEventArgs<Nullable<DateTime>>)
Raises the ValueChanged event when Value property has changed.
Declaration
protected override void OnValueChanged(RoutedPropertyChangedEventArgs<DateTime?> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangedEventArgs<System.Nullable<System.DateTime>> | e | Event args. |
Overrides
OnValueChanging(RoutedPropertyChangingEventArgs<Nullable<DateTime>>)
Provides handling for the ValueChanging event.
Declaration
protected override void OnValueChanging(RoutedPropertyChangingEventArgs<DateTime?> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangingEventArgs<System.Nullable<System.DateTime>> | e | Event args. |
Overrides
ParseValue(String)
Called by ApplyValue to parse user input.
Declaration
protected override DateTime? ParseValue(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | User input. |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | Value parsed from user input. |
Overrides
SelectAllText()
Selects all text.
Declaration
protected override void SelectAllText()