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
)
You cannot use methods in XAML.

Parameters

proposedSize
Type: System.Drawing.Size

The custom-sized area for a WPF element.

Return Value

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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0
Show: