VisualElement.Measure Method

Definition

Overloads

Measure(Double, Double)

Returns the minimum size that an element needs in order to be displayed on the device. Margins are excluded from the measurement, but returned with the size. It is not recommended to call this method outside of the MeasureOverride pass on the parent element.

Measure(Double, Double, MeasureFlags)
Obsolete.

Returns the minimum size that an element needs in order to be displayed on the device.

Measure(Double, Double)

Source:
VisualElement.cs

Returns the minimum size that an element needs in order to be displayed on the device. Margins are excluded from the measurement, but returned with the size. It is not recommended to call this method outside of the MeasureOverride pass on the parent element.

public:
 Microsoft::Maui::Graphics::Size Measure(double widthConstraint, double heightConstraint);
public Microsoft.Maui.Graphics.Size Measure (double widthConstraint, double heightConstraint);
member this.Measure : double * double -> Microsoft.Maui.Graphics.Size
Public Function Measure (widthConstraint As Double, heightConstraint As Double) As Size

Parameters

widthConstraint
Double

The suggested maximum width constraint for the element to render.

heightConstraint
Double

The suggested maximum height constraint for the element to render.

Returns

The minimum size that an element needs in order to be displayed on the device.

Remarks

If the minimum size that the element needs in order to be displayed on the device is larger than can be accommodated by widthConstraint and heightConstraint, the return value may represent a rectangle that is larger in either one or both of those parameters.

Applies to

Measure(Double, Double, MeasureFlags)

Source:
VisualElement.cs
Source:
VisualElement.cs

Caution

Use Measure with no flags.

Returns the minimum size that an element needs in order to be displayed on the device.

public virtual Microsoft.Maui.SizeRequest Measure (double widthConstraint, double heightConstraint, Microsoft.Maui.Controls.MeasureFlags flags = Microsoft.Maui.Controls.MeasureFlags.None);
[System.Obsolete("Use Measure with no flags.")]
public virtual Microsoft.Maui.SizeRequest Measure (double widthConstraint, double heightConstraint, Microsoft.Maui.Controls.MeasureFlags flags = Microsoft.Maui.Controls.MeasureFlags.None);
abstract member Measure : double * double * Microsoft.Maui.Controls.MeasureFlags -> Microsoft.Maui.SizeRequest
override this.Measure : double * double * Microsoft.Maui.Controls.MeasureFlags -> Microsoft.Maui.SizeRequest
[<System.Obsolete("Use Measure with no flags.")>]
abstract member Measure : double * double * Microsoft.Maui.Controls.MeasureFlags -> Microsoft.Maui.SizeRequest
override this.Measure : double * double * Microsoft.Maui.Controls.MeasureFlags -> Microsoft.Maui.SizeRequest
Public Overridable Function Measure (widthConstraint As Double, heightConstraint As Double, Optional flags As MeasureFlags = Microsoft.Maui.Controls.MeasureFlags.None) As SizeRequest

Parameters

widthConstraint
Double

The suggested maximum width constraint for the element to render.

heightConstraint
Double

The suggested maximum height constraint for the element to render.

flags
MeasureFlags

A value that controls whether margins are included in the returned size.

Returns

The minimum size that an element needs in order to be displayed on the device.

Attributes

Remarks

If the minimum size that the element needs in order to be displayed on the device is larger than can be accommodated by widthConstraint and heightConstraint, the return value may represent a rectangle that is larger in either one or both of those parameters.

Applies to