Class

MobileSegmentedButton


Description

A horizontal button made up of multiple, independent segments.

Events

Name

Parameters

Returns

Closing

Opening

Pressed

segementedIndex As Integer

Property descriptions


MobileSegmentedButton.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."

MobileSegmentedButton.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."

MobileSegmentedButton.ControlCount

ControlCount As Integer

The number of child controls in the control.

This property is read-only.


MobileSegmentedButton.Enabled

Enabled As Boolean

Indicates whether the control is enabled or disabled.

Disable the button:

Button1.Enabled = False

MobileSegmentedButton.Height

Height As Double

The height of the control.

This property is read-only.


MobileSegmentedButton.Left

Left As Double

The left position of the control.

This property is read-only.


MobileSegmentedButton.Name

Name As String

The name of the control.


MobileSegmentedButton.Parent

Parent As MobileUIControl

The parent (sometimes called a "Super") class of the control.

This property is read-only.


MobileSegmentedButton.SegmentCount

SegmentCount As Integer

The number of segments.


MobileSegmentedButton.SelectedSegment

SelectedSegment As MobileSegment

The currently selected segment.


MobileSegmentedButton.SelectedSegmentIndex

SelectedSegmentIndex As Integer

The index of the selected segment.


MobileSegmentedButton.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.


MobileSegmentedButton.Top

Top As Double

The top position of the control.

This property is read-only.


MobileSegmentedButton.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

MobileSegmentedButton.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


MobileSegmentedButton.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.


MobileSegmentedButton.AddControl

AddControl(child As MobileUIControl)

Adds a child control to the control.


MobileSegmentedButton.AddSegment

AddSegment(item As MobileSegment)

Adds a segment to the end.

Add segments in the Opening event:

Me.AddSegment(New MobileSegment("Earth"))
Me.AddSegment(New MobileSegment("Sun"))
Me.AddSegment(New MobileSegment("Moon"))

MobileSegmentedButton.AddSegmentAt

AddSegmentAt(index As Integer, item As MobileSegment)

Adds the segment passed at the index passed.

Add a segment at the beginning:

Var item As New MobileSegment("Moon")
SegmentedButton1.AddSegmentAt(0, item)

MobileSegmentedButton.ClearFocus

ClearFocus

Removes the focus from the control.

TextField1.ClearFocus

MobileSegmentedButton.ControlAt

ControlAt(index As Integer) As MobileUIControl

Gets the child control at the specified index.


MobileSegmentedButton.Controls

Controls As Iterable

Allows you to iterate through all the controls that have been added to this control.


MobileSegmentedButton.Handle

Handle As Ptr

The a handle to the underlying native OS control.


MobileSegmentedButton.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

MobileSegmentedButton.RemoveAllSegments

RemoveAllSegments

Removes all segments.

Example:

Me.RemoveAllSegments

MobileSegmentedButton.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


MobileSegmentedButton.RemoveControl

RemoveControl(child As MobileUIControl)

Removes the control from the control.


MobileSegmentedButton.RemoveSegment

RemoveSegment(item As MobileSegment)

Removes the segment passed.

Removes a specific segment:

// MoonSegment is a property of type MobileSegment that
// was previously added to the MobileSegmentedButton control.
SegmentedButton1.RemoveSegment(MoonSegment)

MobileSegmentedButton.RemoveSegmentAt

RemoveSegmentAt(index As Integer)

Removes the segment at the index passed.

Remove the first segment:

SegmentedButton1.RemoveSegmentAt(0)

MobileSegmentedButton.SegmentAt

SegmentAt(index As Integer) As MobileSegment

Returns the MobileSegment at the index passed.


MobileSegmentedButton.SetFocus

SetFocus

Sets the focus to the control.

TextField1.SetFocus

Event descriptions


MobileSegmentedButton.Closing

Closing

Called when the control's layout is closing.


MobileSegmentedButton.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"

MobileSegmentedButton.Pressed

Pressed(segementedIndex As Integer)

Called when the selected segment is pressed.

Compatibility

Mobile projects on all supported mobile operating systems.

See also

MobileUIControl parent class; MobileSegment class