Class
MobileDateTimePicker
Description
Control for choosing a date, time or both.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
✓ |
|||
✓ |
|||
✓ |
|||
✓ |
|||
✓ |
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
constraint As iOSLayoutConstraint |
|||
child As MobileUIControl |
|||
index As Integer |
|||
constraint As iOSLayoutConstraint |
|||
child As MobileUIControl |
|||
Events
Name |
Parameters |
Returns |
---|---|---|
value As DateTime |
||
Enumerations
MobileDateTimePicker.DisplayModes
DisplayModes
The user interface modes that can be used by the DatePicker.
Enum |
---|
DateAndTime |
DateOnly |
TimeOnly |
Property descriptions
MobileDateTimePicker.AccessibilityHint
AccessibilityHint As String
The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.
Me.AccessibilityHint = "Click to calculate the value and display the next screen."
MobileDateTimePicker.AccessibilityLabel
AccessibilityLabel As String
The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.
Me.AccessibilityLabel = "Calculate the value."
MobileDateTimePicker.ControlCount
ControlCount As Integer
The number of child controls in the control.
This property is read-only.
MobileDateTimePicker.DisplayMode
DisplayMode As MobileDateTimePicker.DisplayModes
Uses DisplayModes to specify how the DateTimePicker should appear.
Change the picker to show time only:
StartTimePicker.DisplayMode = MobileDateTimePicker.DisplayModes.TimeOnly
MobileDateTimePicker.Enabled
Enabled As Boolean
Indicates whether the control is enabled or disabled.
Disable the button:
Button1.Enabled = False
MobileDateTimePicker.Height
Height As Double
The height of the control.
This property is read-only.
MobileDateTimePicker.Left
Left As Double
The left position of the control.
This property is read-only.
MobileDateTimePicker.MaximumDate
MaximumDate As DateTime
The maximum selectable date.
Dates after the maximum date still appear, but cannot be selected.
Set the maximum date to 50 years in the future:
Var futureDate As DateTime
Var interval As New DateInterval
interval.Years = 50
futureDate = DateTime.Now + interval
StartDatePicker.MaximumDate = futureDate
MobileDateTimePicker.MinimumDate
MinimumDate As DateTime
The minimum selectable date.
Dates before the minimum date still appear, but cannot be selected.
Limit the minimum date to 100 years in the past:
Var pastDate As DateTime
Var interval As New DateInterval
interval.Years = -100
pastDate = DateTime.Now + interval
StartDatePicker.MinimumDate = pastDate
MobileDateTimePicker.Name
Name As String
The name of the control.
MobileDateTimePicker.Parent
Parent As MobileUIControl
The parent (sometimes called a "Super") class of the control.
This property is read-only.
MobileDateTimePicker.SelectedDate
SelectedDate As DateTime
The date that appears in the DateTimePicker.
Gets the selected date from the date/time picker:
Var theDate As DateTime
theDate = StartDatePicker.SelectedDate
MobileDateTimePicker.TintColor
TintColor As ColorGroup
Changes a control's tint color.
On iOS, the following controls support TintColor:
Enum |
Description |
---|---|
ProgressBar |
The area indicating the value of the control will be drawn in the TintColor. |
Slider |
The area indicating the value of the control will be drawn in the TintColor. |
TextArea |
The cursor and text highlight color will be drawn in the TintColor. |
TextField |
The cursor and text highlight color will be drawn in the TintColor. |
MobileDateTimePicker.Top
Top As Double
The top position of the control.
This property is read-only.
MobileDateTimePicker.Visible
Visible As Boolean
Indicates whether the control is visible.
Make a button invisible:
Button1.Visible = False
MobileDateTimePicker.Width
Width As Double
The width of the control.
This property is read-only.
Method descriptions
MobileDateTimePicker.AddConstraint
AddConstraint(constraint As iOSLayoutConstraint)
Adds a constraint to the control.
This constraint is used by child controls that have been added to this control.
MobileDateTimePicker.AddControl
AddControl(child As MobileUIControl)
Adds a child control to the control.
MobileDateTimePicker.ClearFocus
ClearFocus
Removes the focus from the control.
TextField1.ClearFocus
MobileDateTimePicker.ControlAt
ControlAt(index As Integer) As MobileUIControl
Gets the child control at the specified index.
MobileDateTimePicker.Controls
Controls As Iterable
Allows you to iterate through all the controls that have been added to this control.
MobileDateTimePicker.Handle
Handle As Ptr
The a handle to the underlying native OS control.
MobileDateTimePicker.Refresh
Refresh
Marks the control so that it will be redrawn during the next event loop.
Call Refresh to force a Canvas to redraw itself:
Canvas1.Refresh
MobileDateTimePicker.RemoveConstraint
RemoveConstraint(constraint As iOSLayoutConstraint)
Removes a constraint from the control.
MobileDateTimePicker.RemoveControl
RemoveControl(child As MobileUIControl)
Removes the control from the control.
MobileDateTimePicker.SetFocus
SetFocus
Sets the focus to the control.
TextField1.SetFocus
Event descriptions
MobileDateTimePicker.Closing
Closing
Called when the control's layout is closing.
MobileDateTimePicker.DateChanged
DateChanged(value As DateTime)
Called when the selection in the DateTimePicker is changed.
Changing the SelectedDate property does not cause this event to be called.
MobileDateTimePicker.Opening
Opening
Called when the control's layout is opening.
This is where you typically put initialization code.
This example in the Opening event of a label sets its text to "Hello":
Me.Text = "Hello"
Compatibility
Mobile projects on all supported mobile operating systems.
See also
MobileUIControl parent class; DateTime class