Table of Contents

Class TimePicker

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

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

StyledProperty<string>

MinuteIncrementProperty

Defines the MinuteIncrement property

public static readonly StyledProperty<int> MinuteIncrementProperty

Field Value

StyledProperty<int>

SecondIncrementProperty

Defines the SecondIncrement property

public static readonly StyledProperty<int> SecondIncrementProperty

Field Value

StyledProperty<int>

SelectedTimeProperty

Defines the SelectedTime property

public static readonly StyledProperty<TimeSpan?> SelectedTimeProperty

Field Value

StyledProperty<TimeSpan?>

UseSecondsProperty

Defines the UseSeconds property

public static readonly StyledProperty<bool> UseSecondsProperty

Field Value

StyledProperty<bool>

Properties

ClockIdentifier

Gets or sets the clock identifier, either 12HourClock or 24HourClock

public string ClockIdentifier { get; set; }

Property Value

string

MinuteIncrement

Gets or sets the minute increment in the picker

public int MinuteIncrement { get; set; }

Property Value

int

SecondIncrement

Gets or sets the second increment in the picker

public int SecondIncrement { get; set; }

Property Value

int

SelectedTime

Gets or sets the selected time. Can be null.

public TimeSpan? SelectedTime { get; set; }

Property Value

TimeSpan?

UseSeconds

Gets or sets the use seconds switch, either true or false

public bool UseSeconds { get; set; }

Property Value

bool

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 TemplateAppliedEventArgs

The 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 AvaloniaPropertyChangedEventArgs

The property change details.

OnSelectedTimeChanged(TimeSpan?, TimeSpan?)

protected virtual void OnSelectedTimeChanged(TimeSpan? oldTime, TimeSpan? newTime)

Parameters

oldTime TimeSpan?
newTime TimeSpan?

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 AvaloniaProperty

The property.

state BindingValueType

The current data binding state.

error Exception

The current data binding error, if any.

Events

SelectedTimeChanged

Raised when the SelectedTime property changes

public event EventHandler<TimePickerSelectedValueChangedEventArgs>? SelectedTimeChanged

Event Type

EventHandler<TimePickerSelectedValueChangedEventArgs>