Window Xaml Source Class
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables a non-UWP desktop application (for example, a WPF or Windows Forms application) to host UWP controls in any UI element that is associated with a window handle (HWND).
/// [Windows.Foundation.Metadata.ContractVersion(Windows.UI.Xaml.Hosting.HostingContract, 196608)] /// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] /// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] class DesktopWindowXamlSource : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.UI.Xaml.Hosting.HostingContract), 196608)] [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] public class DesktopWindowXamlSource : System.IDisposable
Public Class DesktopWindowXamlSource Implements IDisposable
Object IInspectable DesktopWindowXamlSource
Windows Desktop Extension SDK (introduced in 10.0.17763.0)
Windows.UI.Xaml.Hosting.HostingContract (introduced in v3.0)
DesktopWindowXamlSource is the main class in the UWP XAML hosting API. This API enables non-UWP desktop applications to host any control that derives from Windows.UI.Xaml.UIElement) in a UI element that is associated with a window handle (HWND). This API can be used by desktop applications built using WPF, Windows Forms, and the Windows API (Win32). For more information, see Using the UWP XAML hosting API in a desktop application.
If you create a DesktopWindowXamlSource object before you create the Windows.UI.Xaml.UIElement objects that will be hosted in it, the framework for hosting Windows.UI.Xaml.UIElement content makes sure all the objects are initialized to the same thread. If you create the Windows.UI.Xaml.UIElement objects before you create the DesktopWindowXamlSource object in which they will be hosted, you must call WindowsXamlManager.InitializeForCurrentThread before you instantiate the Windows.UI.Xaml.UIElement objects.
Because DesktopWindowXamlSource derives from IClosable, so it is recommended that you Close it (Dispose it in .NET) when you’re finished with it.
Initializes a new instance of the DesktopWindowXamlSource class.
Gets or sets the Windows.UI.Xaml.UIElement object that you want to host in the desktop application.
Gets a value that indicates whether the DesktopWindowXamlSource currently has focus in the desktop application.
Closes and releases any resources used by this DesktopWindowXamlSource.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Attempts to programmatically give focus to the DesktopWindowXamlSource in the desktop application.
Occurs when the DesktopWindowXamlSource gets focus in the desktop application (for example, the user presses the Tab key while focus is on the element just before the DesktopWindowXamlSource).
Occurs when the host desktop application receives a request take back focus from the DesktopWindowXamlSource object (for example, the user is on the last focusable element in the DesktopWindowXamlSource and presses Tab).
Submit and view feedback for