Xamarin.Forms Guides | Samples

Xamarin.Forms.VisualElement.OnSizeAllocated Method

This method is called when the size of the element is set during a layout cycle. This method is called directly before the VisualElement.SizeChanged event is emitted. Implement this method to add class handling for this event.

Syntax

protected virtual Void OnSizeAllocated (Double width, Double height)

Parameters

width
The new width of the element.
height
The new height of the element.

Remarks

This method has no default implementation. You should still call the base implementation in case an intermediate class has implemented this method. Most layouts will want to implement this method in order to layout their children during a layout cycle.

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