Class TimePicker
A control to allow the user to select a time.
[TemplatePart("PART_FirstColumnDivider", typeof(Rectangle))]
[TemplatePart("PART_FirstPickerHost", typeof(Border))]
[TemplatePart("PART_FlyoutButton", typeof(Button))]
[TemplatePart("PART_FlyoutButtonContentGrid", typeof(Grid))]
[TemplatePart("PART_HourTextBlock", typeof(TextBlock))]
[TemplatePart("PART_MinuteTextBlock", typeof(TextBlock))]
[TemplatePart("PART_SecondTextBlock", typeof(TextBlock))]
[TemplatePart("PART_PeriodTextBlock", typeof(TextBlock))]
[TemplatePart("PART_PickerPresenter", typeof(TimePickerPresenter))]
[TemplatePart("PART_Popup", typeof(Popup))]
[TemplatePart("PART_SecondColumnDivider", typeof(Rectangle))]
[TemplatePart("PART_SecondPickerHost", typeof(Border))]
[TemplatePart("PART_ThirdColumnDivider", typeof(Rectangle))]
[TemplatePart("PART_ThirdPickerHost", typeof(Border))]
[TemplatePart("PART_FourthPickerHost", typeof(Border))]
[PseudoClasses(new string[] { ":hasnotime" })]
public class TimePicker : TemplatedControl, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
- Inheritance
-
TimePicker
- Implements
- Inherited Members
- Extension Methods
Constructors
TimePicker()
public TimePicker()
Fields
ClockIdentifierProperty
Defines the ClockIdentifier property
public static readonly StyledProperty<string> ClockIdentifierProperty
Field Value
MinuteIncrementProperty
Defines the MinuteIncrement property
public static readonly StyledProperty<int> MinuteIncrementProperty
Field Value
SecondIncrementProperty
Defines the SecondIncrement property
public static readonly StyledProperty<int> SecondIncrementProperty
Field Value
SelectedTimeProperty
Defines the SelectedTime property
public static readonly StyledProperty<TimeSpan?> SelectedTimeProperty
Field Value
UseSecondsProperty
Defines the UseSeconds property
public static readonly StyledProperty<bool> UseSecondsProperty
Field Value
Properties
ClockIdentifier
Gets or sets the clock identifier, either 12HourClock or 24HourClock
public string ClockIdentifier { get; set; }
Property Value
MinuteIncrement
Gets or sets the minute increment in the picker
public int MinuteIncrement { get; set; }
Property Value
SecondIncrement
Gets or sets the second increment in the picker
public int SecondIncrement { get; set; }
Property Value
SelectedTime
Gets or sets the selected time. Can be null.
public TimeSpan? SelectedTime { get; set; }
Property Value
UseSeconds
Gets or sets the use seconds switch, either true or false
public bool UseSeconds { get; set; }
Property Value
Methods
Clear()
Clear SelectedTime.
public void Clear()
OnApplyTemplate(TemplateAppliedEventArgs)
Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameters
e
TemplateAppliedEventArgsThe event args.
OnCreateAutomationPeer()
Returns a new, type-specific AutomationPeer implementation for the control.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer
The type-specific AutomationPeer implementation.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.
OnSelectedTimeChanged(TimeSpan?, TimeSpan?)
protected virtual void OnSelectedTimeChanged(TimeSpan? oldTime, TimeSpan? newTime)
Parameters
UpdateDataValidation(AvaloniaProperty, BindingValueType, Exception?)
Called to update the validation state for properties for which data validation is enabled.
protected override void UpdateDataValidation(AvaloniaProperty property, BindingValueType state, Exception? error)
Parameters
property
AvaloniaPropertyThe property.
state
BindingValueTypeThe current data binding state.
error
ExceptionThe current data binding error, if any.
Events
SelectedTimeChanged
Raised when the SelectedTime property changes
public event EventHandler<TimePickerSelectedValueChangedEventArgs>? SelectedTimeChanged