This documentation is archived and is not being maintained.

HwndHost Class

Hosts a Win32 window as an element within Windows Presentation Foundation (WPF) content. 

Namespace:  System.Windows.Interop
Assembly:  PresentationFramework (in PresentationFramework.dll)

[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public abstract class HwndHost : FrameworkElement, 
	IDisposable, IWin32Window, IKeyboardInputSink
This class is abstract; see Inheritance Hierarchy for derived non-abstract classes usable in XAML.

To host a Win32 window, create a class that derives from HwndHost. Override the BuildWindowCore method and create your Win32 window as a child of the parent window that is passed into the method.

Important noteImportant Note:

Although HwndHost derives from FrameworkElement, various properties of HwndHost that come from FrameworkElement and other intermediate classes such as UIElement are not generally mapped to possible Win32 equivalents. Also, not all FrameworkElement / UIElement input events transfer across the interoperation boundary. HwndHost derives from FrameworkElement primarily so that an HwndHost instance can be inserted into the widest variety of possible content models, and so that default FrameworkElement layout characteristics can apply. For more details on HwndHost, see WPF and Win32 Interoperation Overview.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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