Class TimePicker
Represents a control that allows the user to select a time.
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.Input.Toolkit.dll
Syntax
[TemplatePart(Name = "TimeUpDown", Type = typeof(TimeUpDown))]
[TemplatePart(Name = "Popup", Type = typeof(Popup))]
[TemplatePart(Name = "DropDownToggle", Type = typeof(ToggleButton))]
[TemplatePart(Name = "PopupPlaceHolder", Type = typeof(ContentControl))]
[StyleTypedProperty(Property = "TimeUpDownStyle", StyleTargetType = typeof(TimeUpDown))]
[StyleTypedProperty(Property = "SpinnerStyle", StyleTargetType = typeof(ButtonSpinner))]
public class TimePicker : Picker, 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 SourceTimePicker()
Initializes a new instance of the TimePicker class.
Declaration
public TimePicker()
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 |
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 |
PopupMinutesIntervalProperty
Identifies the PopupMinutesInterval dependency property.
Declaration
public static readonly DependencyProperty PopupMinutesIntervalProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
PopupProperty
Identifies the Popup dependency property.
Declaration
public static readonly DependencyProperty PopupProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
PopupSecondsIntervalProperty
Identifies the PopupSecondsInterval dependency property.
Declaration
public static readonly DependencyProperty PopupSecondsIntervalProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
PopupTemplateProperty
Identifies the PopupTemplate dependency property.
Declaration
public static readonly DependencyProperty PopupTemplateProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
PopupTimeSelectionModeProperty
Identifies the PopupTimeSelectionMode dependency property.
Declaration
public static readonly DependencyProperty PopupTimeSelectionModeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SpinnerStyleProperty
Identifies the SpinnerStyle dependency property.
Declaration
public static readonly DependencyProperty SpinnerStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TimeGlobalizationInfoProperty
Identifies the TimeGlobalizationInfo dependency property.
Declaration
public static readonly DependencyProperty TimeGlobalizationInfoProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TimeParsersProperty
Identifies the TimeParsers dependency property.
Declaration
public static readonly DependencyProperty TimeParsersProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TimeUpDownStyleProperty
Identifies the TimeUpDownStyle dependency property.
Declaration
public static readonly DependencyProperty TimeUpDownStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ValueProperty
Identifies the Value dependency property.
Declaration
public static readonly DependencyProperty ValueProperty
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 |
ActualFormat
Gets the actual format that will be used to display Time in the TimePicker. 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.
ActualTimePickerPopup
Gets the TimePickerPopup that is used by the TimePicker. This can be either a popup created from the PopupTemplate, or a popup set directly to the Popup property. When both are set, the Popup property will win.
Declaration
protected virtual TimePickerPopup ActualTimePickerPopup { get; }
Property Value
Type | Description |
---|---|
TimePickerPopup |
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 |
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: Selecting a value through a popup, 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: Selecting a value through a popup, Parsing a new value from the textbox, spinning a new value and programmatically specifying a value.
Popup
Gets or sets the TimePickerPopup that will be shown to the user by the TimePicker control. This property may not be styled. To style a TimePicker with a Popup, please use the PopupTemplate property. When both PopupTemplate and Popup are set, Popup will be used.
Declaration
public TimePickerPopup Popup { get; set; }
Property Value
Type | Description |
---|---|
TimePickerPopup |
PopupMinutesInterval
Gets or sets the minutes interval between time values allowed by the TimePickerPopup.
Declaration
public int PopupMinutesInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
PopupSecondsInterval
Gets or sets the seconds interval between time values allowed by the TimePickerPopup.
Declaration
public int PopupSecondsInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
PopupTemplate
Gets or sets the template used as Popup. A Popup can also be set directly on the Popup property. When both PopupTemplate and Popup are set, Popup will be used.
Declaration
public TimePickerPopupTemplate PopupTemplate { get; set; }
Property Value
Type | Description |
---|---|
TimePickerPopupTemplate |
PopupTimeSelectionMode
Gets or sets the whether the TimePickerPopup supports selecting designators and/or seconds.
Declaration
public PopupTimeSelectionMode PopupTimeSelectionMode { get; set; }
Property Value
Type | Description |
---|---|
PopupTimeSelectionMode |
SpinnerStyle
Gets or sets the Style that is applied to the spinner.
Declaration
public Style SpinnerStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
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 |
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 |
TimeUpDownStyle
Gets or sets the Style applied to the TimeUpDown portion of the TimePicker control.
Declaration
public Style TimeUpDownStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
Value
Gets or sets the currently selected time.
Declaration
[TypeConverter(typeof(TimeTypeConverter))]
public virtual DateTime? Value { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Methods
| Improve this Doc View SourceGetSelectedValue()
Gets the selected time represented in the control.
Declaration
public override object GetSelectedValue()
Returns
Type | Description |
---|---|
System.Object | The value that is picked. |
Overrides
| Improve this Doc View SourceOnApplyTemplate()
Builds the visual tree for the TimePicker control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnCreateAutomationPeer()
Returns a PickerAutomationPeer for use by the Silverlight automation infrastructure.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer | A PickerAutomationPeer for the Picker object. |
Overrides
| Improve this Doc View SourceOnDropDownClosed(RoutedPropertyChangedEventArgs<Boolean>)
Raises an DropDownClosed event when the IsDropDownOpen property changed from true to false.
Declaration
protected override void OnDropDownClosed(RoutedPropertyChangedEventArgs<bool> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangedEventArgs<System.Boolean> | e | The event data. |
Overrides
| Improve this Doc View SourceOnDropDownOpened(RoutedPropertyChangedEventArgs<Boolean>)
Raises an DropDownOpened event when the IsDropDownOpen property changed from false to true.
Declaration
protected override void OnDropDownOpened(RoutedPropertyChangedEventArgs<bool> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangedEventArgs<System.Boolean> | e | The event data. |
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. |
OnValueChanged(RoutedPropertyChangedEventArgs<Nullable<DateTime>>)
Raises the ValueChanged event when Value property has changed.
Declaration
protected virtual void OnValueChanged(RoutedPropertyChangedEventArgs<DateTime?> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangedEventArgs<System.Nullable<System.DateTime>> | e | Event args. |
OnValueChanging(RoutedPropertyChangingEventArgs<Nullable<DateTime>>)
Raises the ValueChanging event when Value property is changing.
Declaration
protected virtual void OnValueChanging(RoutedPropertyChangingEventArgs<DateTime?> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangingEventArgs<System.Nullable<System.DateTime>> | e | Event args. |
Events
| Improve this Doc View SourceParseError
Occurs when there is an error in parsing user input and allows adding parsing logic.
Declaration
public event EventHandler<UpDownParseErrorEventArgs> ParseError
Event Type
Type | Description |
---|---|
System.EventHandler<UpDownParseErrorEventArgs> |
Parsing
Occurs when a value is being parsed and allows custom parsing.
Declaration
public event EventHandler<UpDownParsingEventArgs<DateTime?>> Parsing
Event Type
Type | Description |
---|---|
System.EventHandler<UpDownParsingEventArgs<System.Nullable<System.DateTime>>> |
ValueChanged
Occurs when Value property has changed.
Declaration
public event RoutedPropertyChangedEventHandler<DateTime?> ValueChanged
Event Type
Type | Description |
---|---|
RoutedPropertyChangedEventHandler<System.Nullable<System.DateTime>> |
ValueChanging
Occurs when Value property is changing.
Declaration
public event RoutedPropertyChangingEventHandler<DateTime?> ValueChanging
Event Type
Type | Description |
---|---|
RoutedPropertyChangingEventHandler<System.Nullable<System.DateTime>> |