Updated: November 2007
Hosts a Win32 window as an element within Windows Presentation Foundation (WPF) content.
<SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags := SecurityPermissionFlag.UnmanagedCode)> _ Public MustInherit Class HwndHost _ Inherits FrameworkElement _ Implements IDisposable, IWin32Window, IKeyboardInputSink
Dim instance As HwndHost
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public abstract class HwndHost : FrameworkElement, IDisposable, IWin32Window, IKeyboardInputSink
[SecurityPermissionAttribute(SecurityAction::InheritanceDemand, Flags = SecurityPermissionFlag::UnmanagedCode)] public ref class HwndHost abstract : public FrameworkElement, IDisposable, IWin32Window, IKeyboardInputSink
/** @attribute SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode) */ public abstract class HwndHost extends FrameworkElement implements IDisposable, IWin32Window, IKeyboardInputSink
public abstract class HwndHost extends FrameworkElement implements 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.
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.
Windows Vista