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 types of data that will be displayed by the DateTimePicker.
Enum |
---|
DateAndTime |
DateOnly |
TimeOnly |
MobileDateTimePicker.DisplayStyles
DisplayStyles
The various ways in which the user interface can be displayed by the DateTimePicker.
Enum |
---|
Wheels |
Compact |
Inline |
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.CaptionColor
CaptionColor As String
The color of the control's caption.
Important
This property is supported for Android only.
MobileDateTimePicker.CaptionFont
CaptionFont As Font
The font of the control's caption.
Important
This property is supported for Android only.
MobileDateTimePicker.ControlCount
ControlCount As Integer
The number of child controls in the control.
This property is read-only.
Important
This property is supported for iOS only.
MobileDateTimePicker.DateCaption
DateCaption As String
The button caption that appears when the DisplayMode is set to DateOnly.
Important
This property is supported for Android only.
MobileDateTimePicker.DisplayMode
DisplayMode As DisplayModes
Uses DisplayModes to specify what data the DateTimePicker can enter.
Change the picker to show time only:
StartTimePicker.DisplayMode = MobileDateTimePicker.DisplayModes.TimeOnly
MobileDateTimePicker.DisplayStyle
DisplayStyle As DisplayModes
Uses DisplayStyles to specify how the DateTimePicker should appear.
Change the picker to compact:
StartTimePicker.DisplayMode = MobileDateTimePicker.DisplayStyles.Compact
MobileDateTimePicker.Enabled
Enabled As Boolean
Indicates whether the control is enabled or disabled.
Disable the button:
Button1.Enabled = False
MobileDateTimePicker.Height
Height As Integer
The height of the control.
This property is read-only on iOS.
MobileDateTimePicker.Left
Left As Integer
The left position of the control.
This property is read-only on iOS.
MobileDateTimePicker.LockBottom
LockBottom As Boolean
Determines whether the bottom edge of the control should stay at a set distance from the bottom edge of the parent control, if there is one, or the owning screen.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockBottom = True
MobileDateTimePicker.LockLeft
LockLeft As Boolean
Determines whether the left edge of the control should stay at a set distance from the left edge of the parent control, if there is one, or the owning screen.
LockLeft and Locktop default to True when you add a new control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockLeft has no effect unless LockRight is True.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockLeft = True
MobileDateTimePicker.LockRight
LockRight As Boolean
Determines whether the right edge of the control should stay at a set distance from the right edge of the parent control, if there is one, or the owning screen.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockRight = True
MobileDateTimePicker.LockTop
LockTop As Boolean
Determines whether the top edge of the control should stay at a set distance from the top edge of the parent control, if there is one, or the owning screen.
LockTop and LockLeft default to True when you add a control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockTop has no effect unless LockBottom is True.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockTop = True
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.
This property is read-only.
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.TimeCaption
TimeCaption As String
The button caption that appears when the DisplayMode is set to TimeOnly.
Important
This property is supported for Android only.
MobileDateTimePicker.Top
Top As Integer
The top position of the control.
This property is read-only on iOS.
MobileDateTimePicker.Visible
Visible As Boolean
Indicates whether the control is visible.
Make a button invisible:
Button1.Visible = False
MobileDateTimePicker.Width
Width As Integer
The width of the control.
This property is read-only on iOS.
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.
Important
This is supported for iOS only.
MobileDateTimePicker.AddControl
AddControl(child As MobileUIControl)
Adds a child control to the control.
Important
This is supported for iOS only.
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.
Important
This is supported for iOS only.
MobileDateTimePicker.Controls
Controls As Iterable
Allows you to iterate through all the controls that have been added to this control.
Important
This is supported for iOS only.
MobileDateTimePicker.Handle
Handle As Ptr
The 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.
Important
This is supported for iOS only.
MobileDateTimePicker.RemoveControl
RemoveControl(child As MobileUIControl)
Removes the control from the control.
Important
This is supported for iOS only.
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