Windows 应用 SDK 1.3 的试验通道发行说明

重要

不支持在生产环境中使用试验通道,并且无法将使用试验版本的应用发布到 Microsoft Store

试验通道提供 Windows App SDK 的版本,其中包括开发早期阶段的试验通道功能。 用于试验功能的 API 具有试验特性。 如果在代码中调用试验 API,会收到生成时警告。 试验通道中的所有 API 在将来的版本中可能会有重大更改,但试验 API 特别容易更改。 试验功能可能会从下一版本中删除,也可能永远不会发布。

重要链接

最新试验通道版本:

最新稳定通道版本:

试验版本 1.3 (1.3.0-experimental1)

这是试验通道的最新版本。 若要下载,请将 WinAppSDK NuGet 版本重新定目标到 1.3.230202101-experimental1

XAML 背景 API

借助 XAML 窗口中的内置属性,现在可以更轻松地在 WinUI 3 应用中使用 Mica & Background Acrylic 背景。

请参阅 GitHub 上的 Xaml Backdrop API 规范,详细了解 Window.SystemBackdrop 属性。

在此版本中需要注意的是,你只能在代码隐藏中设置背景,如下所示。 在标记中设置 <Window.SystemBackdrop> 会导致编译错误。

此外,Xaml Backdrop API 当前缺少一个“实验”标记,因为开发团队正在积极开发中。

public MainWindow()
{
    this.InitializeComponent();

    this.SystemBackdrop = new MicaBackdrop();
}

窗口.App窗口

替换多行样板代码,现在可以直接通过窗口Window.AppWindow使用 AppWindow API。 请参阅 GibHub 上的 Window.AppWindow API 规范,了解其他背景和使用信息。

WinAppSDK 中的新功能

  • ApplicationModel.DynamicDependency:取代已弃用的 MddGetGenerationId 的 PackageDependency.PackageGraphRevisionId
  • 环境管理器:EnvironmentManager.AreChangesTracked 告知你是否可在应用程序中跟踪对环境管理器的更改。 请参阅 GitHub 上的环境管理员 API 规范了解详细信息。
  • MRT 核心:新事件 Application.ResourceManagerInitializing 允许应用提供 IResourceManager 接口其自己的实施,并为应用提供对 Win UI 用于解析安全 URI 的 ResourceManager 访问权限。
  • 现在,使用最新的试验性 VSIX,可以通过 Visual Studio 菜单在未打包和打包之间转换应用,而无需在项目文件中执行此操作。
  • 当无法解析引用的 Static/ThemeResource 查找时,现在会引发新事件 DebugSettings.XamlResourceReferenceFailed。 使用此事件可以访问某个跟踪,该跟踪详细说明了在框架中的哪个位置搜索该键,以便更好地调试 Static 和 ThemeResource 查找失败。 有关详细信息,请参阅 GitHub 上的问题 497223506073

Bug 修复

  • 修复了触摸输入导致软键盘不在文本框上出现的问题。 有关详细信息,请参阅 GitHub 上的问题 6291
  • 修复了导致将 IElementFactory 作为 ItemTemplate 引发 ArgumentException 的 ItemsRepeater 的问题。 有关详细信息,请参阅 GitHub 上的问题 4705

其他实验 API

此版本还包括早期开发的多个 API。

以下列表详细介绍了此实验版本中引入的 API,我们不打算在 1.3.0 稳定版本中交付。

**Microsoft.UI.Content**

    DesktopSiteBridge
        GetInputEnabledToRoot
        GetVisibleToRoot
        InputEnabled
**Microsoft.UI.Dispatching**

    DispatcherQueue
        FrameworkShutdownStarting
**Microsoft.UI.Input**

    InputLightDismissAction
        GetForIsland

    InputNonClientPointerSource
    InputPointerActivationBehavior
    InputPointerSource
        ActivationBehavior

    NonClientRegionCaptionTappedEventArgs
    NonClientRegionHoverEventArgs
    NonClientRegionKind
**Microsoft.UI.Input.DragDrop**

    DragDropManager
    DragDropModifiers
    DragInfo
    DragOperation
    DragUIContentMode
    DragUIOverride
    DropOperationTargetRequestedEventArgs
    IDropOperationTarget
**Microsoft.UI.Xaml.Automation.Peers**

    ItemContainerAutomationPeer
    ItemsViewAutomationPeer
**Microsoft.UI.Xaml.Controls**

    AnnotatedScrollBar
    AnnotatedScrollBarLabel
    AnnotatedScrollBarScrollEventArgs
    AnnotatedScrollBarScrollEventType
    AnnotatedScrollBarScrollOffsetRequestedEventArgs
    AnnotatedScrollBarSubLabelRequestedEventArgs
    AnnotatedScrollBarValueRequestedEventArgs
    ElementFactory
        GetElement
        GetElementCore
        RecycleElement
        RecycleElementCore

    IndexBasedLayoutOrientation
    ItemContainer
    ItemContainerInteractionTrigger
    ItemContainerInvokedEventArgs
    ItemContainerMultiSelectMode
    ItemContainerUserInvokeMode
    ItemContainerUserSelectMode
    ItemsView
    ItemsViewItemInvokedEventArgs
    ItemsViewItemInvokeMode
    ItemsViewSelectionMode
    Layout
        IndexBasedLayoutOrientation

    NonVirtualizingLayout
        IndexBasedLayoutOrientationCore

    RiverFlowLayout
    RiverFlowLayoutItemsInfoRequestedEventArgs
    RiverFlowLayoutItemsJustification
    RiverFlowLayoutItemsStretch
    VirtualizingLayout
        IndexBasedLayoutOrientationCore

    VirtualizingLayoutContext
        VisibleRect
        VisibleRectCore
**Microsoft.Graphics.Display**

    DisplayInformation
        AngularOffsetFromNativeOrientation
        DpiChanged
        OrientationChanged
        RawDpi
        RawPixelsPerViewPixel

    DisplayOrientation
**Microsoft.UI.Xaml.Hosting**

    DesktopWindowXamlSource
        CreateSiteBridge
        SiteBridge
        SystemBackdrop