.NET Framework Class Library
HwndHost Class

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

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

Visual Basic (Declaration)
<SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags := SecurityPermissionFlag.UnmanagedCode)> _
Public MustInherit Class HwndHost _
    Inherits FrameworkElement _
    Implements IDisposable, IWin32Window, IKeyboardInputSink
Visual Basic (Usage)
Dim instance As HwndHost
C#
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public abstract class HwndHost : FrameworkElement, 
    IDisposable, IWin32Window, IKeyboardInputSink
Visual C++
[SecurityPermissionAttribute(SecurityAction::InheritanceDemand, Flags = SecurityPermissionFlag::UnmanagedCode)]
public ref class HwndHost abstract : public FrameworkElement, 
    IDisposable, IWin32Window, IKeyboardInputSink
JScript
public abstract class HwndHost extends FrameworkElement implements IDisposable, IWin32Window, IKeyboardInputSink
XAML
This class is abstract; see Inheritance Hierarchy for derived non-abstract classes usable in XAML.
Remarks

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.

Inheritance Hierarchy

System..::.Object
  System.Windows.Threading..::.DispatcherObject
    System.Windows..::.DependencyObject
      System.Windows.Media..::.Visual
        System.Windows..::.UIElement
          System.Windows..::.FrameworkElement
            System.Windows.Interop..::.HwndHost
              System.Windows.Forms.Integration..::.WindowsFormsHost
Thread Safety

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

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.
Version Information

.NET Framework

Supported in: 3.5, 3.0
See Also

Reference

Other Resources

Tags :


Page view tracker