Presents Windows Presentation Foundation (WPF) content in a Win32 window.
Assembly: PresentationCore (in PresentationCore.dll)
Initializes a new instance of theclass by using a structure that contains the initial settings.
|HwndSource(Int32, Int32, Int32, Int32, Int32, Int32, Int32, String, IntPtr)|
Initializes a new instance of theclass with a specified class style, style, extended style, x-y position, width, height, name, and parent window.
|HwndSource(Int32, Int32, Int32, Int32, Int32, Int32, Int32, String, IntPtr, Boolean)|
Initializes a new instance of theclass with a specified class style, style, extended style, x-y position, width, height, name, and parent window, and by specifying whether the window is autosized.
|HwndSource(Int32, Int32, Int32, Int32, Int32, String, IntPtr)|
Initializes a new instance of theclass with a specified class style, style, extended style, x-y position, name, and parent window.
Gets the value that determines whether to acquire Win32 focus for the WPF containing window for this.
Gets a sequence of registered input sinks.
Gets the visual manager for the hosted window.
Gets or sets the default AcquireHwndFocusInMenuMode value for new instances of .
Gets the window handle for this.
Gets or sets a reference to the component's container's IKeyboardInputSite interface.
Gets the RestoreFocusMode for the window.
Get or sets whether and how the window is sized to its content.
Gets a value that declares whether the per-pixel opacity of the source window content is respected.
Adds an event handler that receives all window messages.
Gets the window handle for the HandleRef structure.. The window handle is packaged as part of a
Releases all managed resources that are used by the Disposed event., and raises the
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Returns theobject of the specified window.
Gets the visual target of the window. (Overrides PresentationSource.GetCompositionTargetCore().)
Serves as the default hash function. (Inherited from Object.)
Gets a value that indicates whether the sink or one of its contained components has focus.
Called when the DPI is going to change for the window.
Called when one of the mnemonics (access keys) for this sink is invoked.
Registers the IKeyboardInputSink interface of a contained component.
Removes the event handlers that were added by AddHook.
Sets focus on either the first tab stop or the last tab stop of the sink.
Returns a string that represents the current object.(Inherited from Object.)
Processes keyboard input at the key-down message level.
Processes WM_CHAR, WM_SYSCHAR, WM_DEADCHAR, and WM_SYSDEADCHAR input messages before the OnMnemonic method is called.
Occurs when layout causes theto automatically resize.
Occurs when content is rendered and ready for user interaction. (Inherited from PresentationSource.)
Occurs when the Dispose method is called on this object.
Occurs when the DPI of the monitor of this Hwnd has changed, or the Hwnd is moved to a monitor with a different DPI.
Occurs when the value of the SizeToContent property changes.
For a description of this member, see IList.Remove.
For a description of this member, see OnMnemonic.
For a description of this member, see RegisterKeyboardInputSink.
For a description of this member, see TabInto.
For a description of this member, see TranslateAccelerator.
For a description of this member, see TranslateChar.
For a description of this member, see KeyboardInputSite.
Many members of this class are unavailable in the Internet security zone.
Animplements a Win32 window that can contain WPF content. The WPF content in the window is arranged, measured, and rendered; and is interactive to input. Because the is specifically designed to interoperate with Win32, this class exposes several low-level Win32 features. You can use this class to do the following:
Specify window styles, window class styles, and extended window styles.
Hook the window procedure.
Provide access to the window handle (HWND).
Destroy the window.
The Handle property, which can be passed by means of PInvoke techniques to Win32 APIs in order to manipulate the window.class is designed for general interoperability and is not designed as a managed HWND wrapper. In general, it does not provide managed methods for manipulating the window or properties for inspecting its state. Instead, the class provides access to the Win32 window handle (HWND) through the
Many aspects of the HwndSourceParameters structure and populate it with the desired parameters. These parameters include the following:can only be specified at construction time. To create an , first create an
The class, window, and extended window styles. You must use PInvoke to change the styles after the window is created. Not all styles can be changed after the window is created. Consult the Win32 documentation before changing window styles.
The initial position of the window.
The initial size of the window, which includes whether the size is specified or should be determined from the determined size of the WPF content.
The parent window.
The HwndSourceHook to include in the window procedure chain. If you specify a hook at construction time, it receives all messages for the window. You can use AddHook to add a hook after the window is created.
The transparency settings. A top-level window can be configured to blend with the other windows on the desktop according to the per-pixel transparency of the WPF content. To enable this, set the UsesPerPixelOpacity property in the HwndSourceParameters to true. This property can only be specified at construction time, and only through the HwndSource(HwndSourceParameters) constructor signature, and it imposes several limitations.
An IDisposable. Synchronously calling Dispose immediately destroys the Win32 window if called from the owner thread. If called from another thread, the Win32 window is destroyed asynchronously. Calling Dispose explicitly from the interoperating code might be necessary for certain interoperation scenarios.is a regular common language runtime (CLR) object, and its lifetime is managed by the garbage collector. Because the represents an unmanaged resource, implements
The HwndSourceParameters.HwndSourceHook property, or you can also use AddHook and RemoveHook to add and remove hooks after the window is created. The hooks are called by last-in first-out order, which enables your hooks to execute before the built-in processing. The actual hooks are held by a weak reference. Therefore, make sure that you manage the lifetime of your hook delegate.class implements its own window procedure. This window procedure is used to process important window messages, such as those related to layout, rendering, and input. However, you can also hook the window procedure for your own use. You can specify your own hook during construction by setting the
For more information about WPF and Win32 Interoperation.and other interoperation classes, see
Notice how the constructors for CreateWindowEx.take parameters that resemble the parameters for Win32 functions such as
Available since 3.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.