Class

MobileRectangle


Description

This is the standard Rectangle control.

Events

Name

Parameters

Returns

Closing

Opening

Enumerations

MobileRectangle.BlurStyles

BlurStyles

The type of blur to apply.

Enum

Description

ExtraLight

The area of the view is lighter in hue than the underlying view.

Light

The area of the view is the same approximate hue of the underlying view.

Dark

The area of the view is darker in hue than the underlying view.

ExtraDark

The area of the view is even more dark in hue than the underlying view.

Regular

A regular blur style that adapts to the user interface style.

Prominent

A blur style for making content more prominent that adapts to the user interface style.

UltraThinMaterial

An adaptable blur effect that creates the appearance of an ultra-thin material.

ThisMaterial

An adaptable blur effect that creates the appearance of a thin material.

Material

An adaptable blur effect that creates the appearance of a material with normal thickness.

ThickMaterial

An adaptable blur effect that creates the appearance of a material that is thicker than normal.

ChromeMaterial

An adaptable blur effect that creates the appearance of the system chrome.

UltraThinMaterialLight

A blur effect that creates the appearance of an ultra-thin material and is always light.

ThinMaterialLight

A blur effect that creates the appearance of a thin material and is always light.

MaterialLight

A blur effect that creates the appearance of a material with normal thickness and is always light.

ThickMaterialLight

A blur effect that creates the appearance of a material that is thicker than normal and is always light.

ChromeMaterialLight

A blur effect that creates the appearance of the system chrome and is always light.

UltraThinMaterialDark

A blur effect that creates the appearance of an ultra-thin material and is always dark.

ThinMaterialDark

A blur effect that creates the appearance of a thin material and is always dark.

MaterialDark

A blur effect that creates the appearance of a material with normal thickness and is always dark.

ThickMaterialDark

A blur effect that creates the appearance of a material that is thicker than normal and is always dark.

ChromeMaterialDark

A blur effect that creates the appearance of the system chrome and is always dark.

MobileRectangle.VibrancyStyles

VibrancyStyles

The type of vibrancy to apply.

Enum

Description

None

No vibrancy.

Label

A style for labels containing primary content.

SecondaryLabel

A style for labels containing secondary content.

TertiaryLabel

A style for labels containing tertiary content.

QuaternaryLabel

A style for labels containing quaternary content.

Fill

A style for views with large filled areas containing primary content.

SecondaryFill

A style for views with large filled areas containing secondary content.

TertiaryFill

A style for views with large filled areas containing tertiary content.

Separator

A style for separator lines.

Property descriptions


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

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

MobileRectangle.BorderColor

BorderColor As Color

The color of the border.


MobileRectangle.BorderColor

BorderColor As ColorGroup

The color of the border.

Important

Using a ColorGroup is not currently supported for Android.


MobileRectangle.BorderThickness

BorderThickness As Double

The thickness of the border in points.


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


MobileRectangle.CornerSize

CornerSize As Double

The size of the corner in points. Used to create rounded corners.

Round the corners:

Rectangle1.CornerSize = 25

MobileRectangle.Enabled

Enabled As Boolean

Indicates whether the control is enabled or disabled.

Disable the button:

Button1.Enabled = False

MobileRectangle.FillColor

FillColor As Color

The fill color.


MobileRectangle.FillColor

FillColor As ColorGroup

The fill color.

Important

Using a ColorGroup is not currently supported for Android.


MobileRectangle.Height

Height As Integer

The height of the control.

This property is read-only on iOS.


MobileRectangle.Left

Left As Integer

The left position of the control.

This property is read-only on iOS.


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

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

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

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

MobileRectangle.Name

Name As String

The name of the control.

This property is read-only.


MobileRectangle.Parent

Parent As MobileUIControl

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

This property is read-only.


MobileRectangle.TintColor

TintColor As ColorGroup

Changes a control's tint color.

Important

This is supported for iOS only.

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.


MobileRectangle.Top

Top As Integer

The top position of the control.

This property is read-only on iOS.


MobileRectangle.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

MobileRectangle.Width

Width As Integer

The width of the control.

This property is read-only on iOS.

Method descriptions


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


MobileRectangle.AddControl

AddControl(child As MobileUIControl)

Adds a child control to the control.

Important

This is supported for iOS only.


MobileRectangle.ClearFocus

ClearFocus

Removes the focus from the control.

TextField1.ClearFocus

MobileRectangle.ControlAt

ControlAt(index As Integer) As MobileUIControl

Gets the child control at the specified index.

Important

This is supported for iOS only.


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


MobileRectangle.Handle

Handle As Ptr

The handle to the underlying native OS control.


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

MobileRectangle.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.

Important

This is supported for iOS only.


MobileRectangle.RemoveControl

RemoveControl(child As MobileUIControl)

Removes the control from the control.

Important

This is supported for iOS only.


MobileRectangle.SetEffect

SetEffect(blurStyle As BlurStyles, vibrancyStyle As VibrancyStyles = VibrancyStyles.None, vibrantContent As MobileContainer = Nil)

Sets the blur effect for the rectangle.

  • blurStyle as MobileRectangle.BlurStyles - The type of blur. The BlurStyles enum defines 21 different styles, the first 6 work on all supported versions of iOS (10-13) styles 7-21 were introduced with iOS 13 and will only work on those devices.

  • vibrancyStyle as MobileRectangle.VibrancyStyles - Specifies the type of vibrancy you'd like to use with this rectangle. iOS 10-12 support two of the eight styles (Label and Fill) whereas iOS 13 supports all eight styles.

  • vibrancyContent as MobileContainer - the content that you'd like to have exhibit vibrancy within the rectangle.

In order for the effect to take place, the background color of the parent view must to be set to clear. For example: ParentRectangle.FillColor = Color.Clear

Important

This is supported for iOS only.


MobileRectangle.SetFocus

SetFocus

Sets the focus to the control.

TextField1.SetFocus

Event descriptions


MobileRectangle.Closing

Closing

Called when the control's layout is closing.


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

Sample code

Sample Code In the Opening event handler, update the rectangle to have thick blue borders, rounded corners and a red fill:

Me.BorderColor = Color.Blue
Me.BorderThickness = 10
Me.CornerSize = 25
Me.FillColor = Color.Red

Compatibility

Mobile projects on all supported mobile operating systems.