This documentation is archived and is not being maintained.

UIElement.OnChildDesiredSizeChanged Method

Supports layout behavior when a child element is resized.

Namespace:  System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

protected virtual void OnChildDesiredSizeChanged(
	UIElement child


Type: System.Windows.UIElement
The child element that is being resized.

This method is typically not called by your application code. It is exposed so that derived element classes can make further checks on their own possibly invalid layout state. Classes could also attempt optimizations to minimize the processing time for a layout pass based on size changes to child elements. An example derived element class that implements OnChildDesiredSizeChanged is the Grid control.

Notes to Inheritors

The OnChildDesiredSizeChanged method has the default implementation of calling InvalidateMeasure on itself. A typical implementation would be: do whatever optimization your own element supports, and then typically call base OnChildDesiredSizeChanged from at least one of the code branches (the one that indicated "dirty" state per your own measure caching logic).

This method is only called in the layout processing if it was the child itself that originated the size changes. Otherwise, if the parent element initiates the Measure pass, according to the layout system rules, the parent is recalculating layout already. The layout system processes layout in the order of child-to-parent, so no return to parent element sizing from the child element layout calls is necessary.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.