WindowsXamlManager Class
Definition
Important
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.
Represents the WinUI XAML framework in a non-Windows App SDK (WASDK) desktop application (for example, a WPF or Windows Forms application).
public ref class WindowsXamlManager sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class WindowsXamlManager final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class WindowsXamlManager : System.IDisposable
Public NotInheritable Class WindowsXamlManager
Implements IDisposable
- Inheritance
- Attributes
- Implements
Remarks
WindowsXamlManager is part of the Windows App SDK XAML hosting API. This API enables non-WASDK desktop applications to host any control that derives from Microsoft.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).
Changes from WinAppSDK 1.4 to WinAppSDK 1.5
WinAppSDK 1.4 | WinAppSDK 1.5 and later |
---|---|
The XAML runtime shuts down asynchronously on a thread when all the WindowsXamlManager and DesktopWindowXamlSource objects on that thread have been closed or destroyed, or the DispatcherQueue running on that thread is shut down. |
The XAML runtime shuts down on a thread only when the DispatcherQueue on the thread shuts down. |
WindowsXamlManager.InitializeForCurrentThread returns a new object each time it is called. | WindowsXamlManager.InitializeForCurrentThread returns the same WindowsXamlManager instance until the DispatcherQueue on the thread shuts down. |
Methods
Close() |
Closes and asynchronously releases any resources used by this WindowsXamlManager. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
GetForCurrentThread() |
Gets the |
InitializeForCurrentThread() |
Initializes the WinUI XAML framework in a non-Windows App SDK (WASDK) desktop application (for example, a WPF or Windows Forms application) on the current thread. |
Events
XamlShutdownCompletedOnThread |
Occurs when the XAML runtime has finished its shutdown process on the current thread. |