Xamarin.Forms Guides | Samples

Xamarin.Forms.VisualElement.GetSizeRequest Method

Returns the SizeRequest of the element. Calling this method begins the measure pass of a layout cycle.

Syntax

[System.Obsolete("Use Measure")]
public virtual SizeRequest GetSizeRequest (Double widthConstraint, Double heightConstraint)

See Also

Parameters

widthConstraint
The available width that a parent element can allocated to a child. Value will be between 0 and double.PositiveInfinity.
heightConstraint
The available height that a parent element can allocated to a child. Value will be between 0 and double.PositiveInfinity.

Returns

A SizeRequest which contains a requested size and a minimum size.

Remarks

Calling GetSizeRequest causes a measure pass to occur for the subtree of elements it is called on. It is ideal to only call GetSizeRequest when needed as excessive calls can negatively impact the performance of your app. Overriding GetSizeRequest should only be done if you want to ignore Width/HeightRequest. More likely a subclass would wish to override VisualElement.OnSizeRequest.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0