共用方式為


WindowsXamlManager 類別

定義

表示非 Windows 應用程式 SDK (WASDK) 傳統型 (應用程式中的 WinUI XAML 架構,例如 WPF 或 Windows Forms 應用程式) 。

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
繼承
Object Platform::Object IInspectable WindowsXamlManager
屬性
實作

備註

WindowsXamlManager#D179EB8E483D54011B264A2A2E52D58B1 XAML 裝載 API 的一部分。 此 API 可讓非 WASDK 傳統型應用程式裝載與視窗句柄 (HWND) 相關聯之 UI 元素中衍生自 Microsoft.UI.Xaml.UIElement 的任何控件。 此 API 可由使用 WPF、Windows Forms 和 Windows API (Win32) 所建置的桌面應用程式使用。

從 WinAppSDK 1.4 變更為 WinAppSDK 1.5

WinAppSDK 1.4 WinAppSDK 1.5 和更新版本
當該線程上的所有 WindowsXamlManagerDesktopWindowXamlSource 物件已關閉或終結時,XAML 運行時間會在線程上以異步方式關閉,或關閉在該線程上執行的 DispatcherQueue 只有在線程上的 DispatcherQueue 關閉時,XAML 執行時間才會在線程上關閉。
每次呼叫 WindowsXamlManager.InitializeForCurrentThread 時,都會傳回新的 物件。 WindowsXamlManager.InitializeForCurrentThread 會傳回相同的 WindowsXamlManager 實例,直到線程上的 DispatcherQueue 關閉為止。

方法

Close()

關閉並異步釋放此 WindowsXamlManager 所使用的任何資源。

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

GetForCurrentThread()

WindowsXamlManager取得與目前線程相關聯的物件,如果有的話。

InitializeForCurrentThread()

初始化非 Windows 應用程式 SDK (WASDK) 傳統型 (應用程式中的 WinUI XAML 架構,例如,目前線程上的 WPF 或 Windows Forms 應用程式) 。

事件

XamlShutdownCompletedOnThread

發生於 XAML 運行時間在目前線程上完成其關機程式時。

適用於

另請參閱