Class SfTimePicker
Initializes a new instance of the SfTimePicker class that represents a control, used to select the time with in specified list of times.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Toolkit.Picker
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public class SfTimePicker : PickerBase, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, IPicker, IPickerView, IColumnHeaderView, IFooterView, IHeaderView, IPickerCommon, IParentThemeElement, IThemeElement
Constructors
SfTimePicker()
Initializes a new instance of the SfTimePicker class.
Declaration
public SfTimePicker()
Fields
BlackoutTimesProperty
Identifies the BlackoutTimes dependency property.
Declaration
public static readonly BindableProperty BlackoutTimesProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for BlackoutTimes dependency property. |
ColumnHeaderViewProperty
Identifies the ColumnHeaderView dependency property.
Declaration
public static readonly BindableProperty ColumnHeaderViewProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for ColumnHeaderView dependency property. |
FormatProperty
Identifies the Format dependency property.
Declaration
public static readonly BindableProperty FormatProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Format dependency property. |
HeaderViewProperty
Identifies the HeaderView dependency property.
Declaration
public static readonly BindableProperty HeaderViewProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for HeaderView dependency property. |
HourIntervalProperty
Identifies the HourInterval dependency property.
Declaration
public static readonly BindableProperty HourIntervalProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for HourInterval dependency property. |
MaximumTimeProperty
Identifies the MaximumTime dependency property.
Declaration
public static readonly BindableProperty MaximumTimeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for MaximumTime dependency property. |
MinimumTimeProperty
Identifies the MinimumTime dependency property.
Declaration
public static readonly BindableProperty MinimumTimeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for MinimumTime dependency property. |
MinuteIntervalProperty
Identifies the MinuteInterval dependency property.
Declaration
public static readonly BindableProperty MinuteIntervalProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for MinuteInterval dependency property. |
SecondIntervalProperty
Identifies the SecondInterval dependency property.
Declaration
public static readonly BindableProperty SecondIntervalProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for SecondInterval dependency property. |
SelectedTimeProperty
Identifies the SelectedTime dependency property.
Declaration
public static readonly BindableProperty SelectedTimeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for SelectedTime dependency property. |
SelectionChangedCommandProperty
Identifies the SelectionChangedCommand dependency property.
Declaration
public static readonly BindableProperty SelectionChangedCommandProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for SelectionChangedCommand dependency property. |
Properties
BlackoutTimes
Gets or sets the BlackoutTimes in SfTimePicker.
Declaration
public ObservableCollection<TimeSpan> BlackoutTimes { get; set; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<System.TimeSpan> |
Remarks
The selection view will not be applicable when setting blackout times.
Examples
The following examples demonstrate how to set the blackout times in SfTimePicker.
<picker:SfTimePicker x:Name="picker">
<picker:SfTimePicker.BlackoutTimes>
<x:TimeSpan>12:28:00</x:TimeSpan>
<x:TimeSpan>12:26:00</x:TimeSpan>
<x:TimeSpan>12:24:00</x:TimeSpan>
<x:TimeSpan>12:22:00</x:TimeSpan>
<x:TimeSpan>12:37:00</x:TimeSpan>
<x:TimeSpan>12:35:00</x:TimeSpan>
<x:TimeSpan>12:33:00</x:TimeSpan>
<x:TimeSpan>12:32:00</x:TimeSpan>
</picker:SfTimePicker.BlackoutTimes>
</picker:SfTimePicker>
ColumnHeaderView
Gets or sets the value of column header view. This property can be used to customize the header column in SfTimePicker.
Declaration
public TimePickerColumnHeaderView ColumnHeaderView { get; set; }
Property Value
Type |
---|
TimePickerColumnHeaderView |
Examples
The following example demonstrates how to customize the column header view of SfTimePicker.
SfTimePicker timePicker = new SfTimePicker();
timePicker.ColumnHeaderView = new TimePickerColumnHeaderView
{
Background = new SolidColorBrush(Colors.LightBlue),
Height = 40,
DividerColor = Colors.Gray,
TextStyle = new PickerTextStyle
{
TextColor = Colors.DarkBlue,
FontSize = 16
},
HourHeaderText = "Hour",
MinuteHeaderText = "Minute",
SecondHeaderText = "Second",
MeridiemHeaderText = "AM/PM"
};
Format
Gets or sets the picker date format in SfTimePicker.
Declaration
public PickerTimeFormat Format { get; set; }
Property Value
Type | Description |
---|---|
PickerTimeFormat |
Examples
The following examples demonstrate how to set the time format in SfTimePicker.
HeaderView
Gets or sets the value of header view. This property can be used to customize the header in SfTimePicker.
Declaration
public PickerHeaderView HeaderView { get; set; }
Property Value
Type |
---|
PickerHeaderView |
Examples
The following example demonstrates how to customize the header view of SfTimePicker.
SfTimePicker timePicker = new SfTimePicker();
timePicker.HeaderView = new PickerHeaderView
{
Text = "Select Time",
TextStyle = new PickerTextStyle
{
TextColor = Colors.Blue,
FontSize = 18,
FontAttributes = FontAttributes.Bold
},
Background = new SolidColorBrush(Colors.LightGray)
};
HourInterval
Gets or sets the hour interval in SfTimePicker.
Declaration
public int HourInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value of HourInterval is 1. |
Examples
The following examples demonstrate how to set the hour interval in SfTimePicker.
MaximumTime
Gets or sets the maximum time in SfTimePicker.
Declaration
public TimeSpan MaximumTime { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan | The default value of MaximumTime is "TimeSpan(23, 59, 59)". |
Examples
The following examples demonstrate how to set the maximum time in SfTimePicker.
MinimumTime
Gets or sets the minimum time in SfTimePicker.
Declaration
public TimeSpan MinimumTime { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan | The default value of MinimumTime is System.TimeSpan.Zero. |
Examples
The following examples demonstrate how to set the minimum time in SfTimePicker.
MinuteInterval
Gets or sets the minute interval in SfTimePicker.
Declaration
public int MinuteInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value of MinuteInterval is 1. |
Examples
The following examples demonstrate how to set the minute interval in SfTimePicker.
SecondInterval
Gets or sets the second interval in SfTimePicker.
Declaration
public int SecondInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value of SecondInterval is 1. |
Examples
The following examples demonstrate how to set the second interval in SfTimePicker.
SelectedTime
Gets or sets the time picker selection time in SfTimePicker.
Declaration
public Nullable<TimeSpan> SelectedTime { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | The default value of SelectedTime is "TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)". |
Examples
The following examples demonstrate how to set the selected time in SfTimePicker.
SelectionChangedCommand
Gets or sets the selection changed command in SfTimePicker.
Declaration
public ICommand SelectionChangedCommand { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | The default value of SelectionChangedCommand is null. |
Examples
The following example demonstrates how to set the selection changed command in SfTimePicker.
<ContentPage.BindingContext>
<local:ViewModel/>
</ContentPage.BindingContext>
<Picker:SfTimePicker x:Name="TimePicker"
SelectionChangedCommand="{Binding SelectionCommand}">
</Picker:SfTimePicker>
Methods
Initialize()
Method to wire the events.
Declaration
protected override void Initialize()
Overrides
OnBindingContextChanged()
Method triggers when the property binding context changed.
Declaration
protected override void OnBindingContextChanged()
Overrides
OnCancelButtonClicked(EventArgs)
Method triggers when the time picker cancel button clicked.
Declaration
protected override void OnCancelButtonClicked(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The event arguments |
Overrides
OnOkButtonClicked(EventArgs)
Method triggers when the time picker ok button clicked.
Declaration
protected override void OnOkButtonClicked(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The event arguments |
Overrides
OnPopupClosed(EventArgs)
Method triggers when the time picker popup closed.
Declaration
protected override void OnPopupClosed(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The event arguments |
Overrides
OnPopupClosing(CancelEventArgs)
Method triggers when the time picker popup closing.
Declaration
protected override void OnPopupClosing(CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CancelEventArgs | e | The event arguments |
Overrides
OnPopupOpened(EventArgs)
Method triggers when the time picker popup opened.
Declaration
protected override void OnPopupOpened(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The event arguments |
Overrides
Events
SelectionChanged
Occurs after the selected time is changed on SfTimePicker.
Declaration
public event EventHandler<TimePickerSelectionChangedEventArgs> SelectionChanged
Event Type
Type |
---|
System.EventHandler<TimePickerSelectionChangedEventArgs> |