This documentation is archived and is not being maintained.

ElementHost.GetPreferredSize Method

Overrides the base class implementation GetPreferredSize to provide correct layout behavior for the hosted Windows Presentation Foundation (WPF) elements.

Namespace: System.Windows.Forms.Integration
Assembly: WindowsFormsIntegration (in windowsformsintegration.dll)

public override Size GetPreferredSize (
	Size proposedSize
public Size GetPreferredSize (
	Size proposedSize
public override function GetPreferredSize (
	proposedSize : Size
) : Size
Not applicable.



The custom-sized area for a WPF element.

Return Value

The System.Drawing.Size computed by the ElementHost control, given the constraints specified by proposedSize.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0