重要
预览通道不支持在生产环境中使用,并且无法将使用预览版本的应用发布到 Microsoft Store。
此预览通道包括 Windows App SDK 的多个版本,其中附带处于开发后期阶段的预览通道功能。 预览版本不含实验功能和 API,但在下一稳定版本之前仍可能会出现重大更改。
重要链接:
- 如果要将现有应用从较旧版本的 Windows 应用 SDK 升级到较新版本,请参阅 将现有项目更新到最新版本的 Windows 应用 SDK。
- 有关预览版的文档,请参阅 安装 Windows 应用 SDK 的预览和实验通道工具。
最新预览频道版本:
最新的稳定频道版本:
版本 1.4 预览版 2 (1.4.0-preview2)
这是版本 1.4 的预览频道的最新版本。
在现有从稳定通道的 Windows 应用 SDK 1.3 应用中,您可以将 NuGet 包更新到 1.4.0-preview2。请参阅 使用 NuGet 包管理器在 Visual Studio 中安装和管理包 中的 更新包 部分。
有关更新的运行时和 MSIX,请参阅 最新的 Windows 应用 SDK 下载。
XAML 岛不再试验性
XAML 岛屿和底层 ContentIslands 平台不再是实验性的。
- 目前,XAML 岛仅在C++应用中进行测试以供使用。 此版本不包含用于 WPF 或 WinForms 的任何便捷包装元素。
-
DesktopWindowXamlSource和相关类型已添加到为 XAML 岛设计的 Microsoft.UI.Xaml.Hosting 命名空间中。XamlRoot.ContentIslandEnvironment已添加以帮助访问元素的底层岛屿信息。 - Microsoft.UI.Content 命名空间和 Microsoft.UI.Input 命名空间中引入了许多新类型,作为 XAML 岛的基础支持,或者用于在没有 XAML 的情况下使用 ContentIslands 功能。
- 在 Microsoft.UI.Input.DragDrop 命名空间中添加了新的
DragDropManager(以及相关类型)用于 Island 场景。
ItemsView 更新
版本 1.4-preview1 中引入的新 ItemsView 类已使用新属性和新的支持类进行了实质性更新。
- 新
ItemsView控件显示数据收集。ItemsView与ListViewGridView控件类似,但使用ItemsRepeater和ScrollViewItemContainerItemCollectionTransitionProvider组件生成。 它提供了插入自定义Layout或ItemCollectionTransitionProvider实现的独特功能。 另一个关键优势是能够在保留项目选择的同时动态切换布局。 内部ScrollView控件还提供一些ListView/GridView的ScrollViewer控件所没有的功能,例如在编程滚动期间控制动画的能力。- 新的
ItemTransitionProvider属性位于ItemsRepeater(以及新ItemsView控件)上,可以指定一个ItemCollectionTransitionProvider对象来控制该控件的过渡动画。 此外,一个CreateDefaultItemTransitionProvider方法已添加到Layout内,该方法使布局对象能够在ItemsView控件未明确提供转换时提供回退转换。 - 一个新的
IndexBasedLayoutOrientation属性Layout,在其中,项的布局方向(如果有)基于它们在源集合中的索引。 默认值是IndexBasedLayoutOrientation.None。 自定义布局通过调用新的 (protected)SetIndexBasedLayoutOrientation方法来设置此属性。 -
VisibleRect的新属性获取与VirtualizingLayoutContext关联的FrameworkElement中的Layout的可见视区矩形。 可以重写受保护的虚拟VirtualizingLayoutContext.VisibleRectCore方法,以提供从VisibleRect属性返回的值。
- 新的
- 新
LinedFlowLayout类通常用于布局集合控件的ItemsView项。 它特别适用于显示图片集合。 它通过将它们从左到右、从上到下排列,并安排在高度相等的行中来实现。 图片在一行中排列,然后换行到下一行。 图片可能会在左右边缘被裁剪,以便适应一行。 在采用拉伸模式时,它们还可以水平展开并裁剪在顶部和下边缘以填充线条。
Windows 应用 SDK 中的新功能和更新
-
Popup/FlyoutBase.IsConstrainedToRootBounds = false现在受支持,允许弹出窗口/浮出控件扩展到父窗口边界之外。 已在这些类型中添加一个SystemBackdrop属性,以支持在这些开放式弹出窗口中使用亚克力。 默认情况下,菜单使用这种方式来实现亚克力效果。 -
Closed、FrameworkClosed和IsClosed已添加到DesktopAcrylicController和MicaController以在对象/线程关闭期间改进处理。 -
DesktopAcrylicController.Kind现在可以设置为在一些标准亚克力外观之间进行选择。 -
DispatcherQueue有一些新的事件和助手功能,能够更好地管理关闭过程,并让使用 Islands 的应用程序轻松运行标准支持的事件循环。 - Microsoft.UI.Input 命名空间中的
InputNonClientPointerSource可用于自定义标题栏场景以定义非客户端区域。 代码可以为这些区域注册相应的事件,例如悬停事件和点击事件。 -
AppWindow有一些新的帮助程序来获取和关联DispatcherQueue。 - 新的
TreeView.SelectionChanged事件允许开发人员在用户或后台代码更改TreeView控件中已选节点集时响应。 - 新的
ScrollView控件提供了ScrollViewer的替代品。 此新控件的行为和 API 与现有的ScrollViewer控件高度一致,但它基于InteractionTracker,具有动画驱动的视图变化等新功能,并且设计用于确保ItemsRepeater的完整功能。 请参阅 更灵活的 ScrollViewer ·问题 #108 ·microsoft/microsoft-ui-xaml (github.com) 了解更多详细信息。 各种新类型(包括ScrollPresenter)是整体ScrollView模型的一部分。 - 新
AnnotatedScrollBar控件扩展了常规滚动条的功能,提供了一种简单方法,让用户能够轻松浏览大量项目。 这是通过一个可单击的滑轨实现的,其中的标签充当标记。 它还允许在悬停在可单击的导轨上时显示工具提示,从而更精细地了解可滚动内容。
1.4.0-preview2 中的新 API
版本 1.4-preview2 包括与以前的 1.4-preview1 版本相比的以下新 API:
Microsoft.UI
ClosableNotifierHandler
IClosableNotifier
Microsoft.UI.Composition.SystemBackdrops
DesktopAcrylicController
Closed
FrameworkClosed
IsClosed
Kind
DesktopAcrylicKind
MicaController
Closed
FrameworkClosed
IsClosed
Microsoft.UI.Content
ContentCoordinateConverter
ContentCoordinateRoundingMode
ContentDeferral
ContentEnvironmentSettingChangedEventArgs
ContentEnvironmentStateChangedEventArgs
ContentIsland
ContentIslandAutomationProviderRequestedEventArgs
ContentIslandEnvironment
ContentIslandStateChangedEventArgs
ContentLayoutDirection
ContentSite
ContentSiteEnvironment
ContentSiteEnvironmentView
ContentSiteRequestedStateChangedEventArgs
ContentSiteView
ContentSizePolicy
DesktopChildSiteBridge
DesktopSiteBridge
IContentSiteBridge
Microsoft.UI.Dispatching
DispatcherExitDeferral
DispatcherQueue
EnqueueEventLoopExit
EnsureSystemDispatcherQueue
FrameworkShutdownCompleted
FrameworkShutdownStarting
RunEventLoop
RunEventLoop
DispatcherQueueController
ShutdownQueue
DispatcherRunOptions
Microsoft.UI.Input
CharacterReceivedEventArgs
ContextMenuKeyEventArgs
FocusChangedEventArgs
InputActivationListener
GetForIsland
InputFocusChangedEventArgs
InputFocusController
InputKeyboardSource
CharacterReceived
ContextMenuKey
GetCurrentKeyState
GetForIsland
GetKeyState
KeyDown
KeyUp
SystemKeyDown
SystemKeyUp
InputNonClientPointerSource
InputPointerSource
GetForIsland
InputPreTranslateKeyboardSource
KeyEventArgs
NonClientCaptionTappedEventArgs
NonClientPointerEventArgs
NonClientRegionKind
NonClientRegionsChangedEventArgs
PhysicalKeyStatus
VirtualKeyStates
Microsoft.UI.Input.DragDrop
DragDropManager
DragDropModifiers
DragInfo
DragOperation
DragUIContentMode
DragUIOverride
DropOperationTargetRequestedEventArgs
IDropOperationTarget
Microsoft.UI.Windowing
AppWindow
AssociateWithDispatcherQueue
Create
DispatcherQueue
Microsoft.UI.Xaml
XamlRoot
ContentIslandEnvironment
Microsoft.UI.Xaml.Automation.Peers
ItemsViewAutomationPeer
Microsoft.UI.Xaml.Controls
AnnotatedScrollBar
AnnotatedScrollBarDetailLabelRequestedEventArgs
AnnotatedScrollBarLabel
AnnotatedScrollBarScrollingEventArgs
AnnotatedScrollBarScrollingEventKind
IndexBasedLayoutOrientation
ItemCollectionTransition
ItemCollectionTransitionCompletedEventArgs
ItemCollectionTransitionOperation
ItemCollectionTransitionProgress
ItemCollectionTransitionProvider
ItemCollectionTransitionTriggers
ItemsRepeater
ItemTransitionProvider
ItemTransitionProviderProperty
ItemsView
ItemsViewItemInvokedEventArgs
ItemsViewSelectionChangedEventArgs
ItemsViewSelectionMode
Layout
CreateDefaultItemTransitionProvider
IndexBasedLayoutOrientation
SetIndexBasedLayoutOrientation
LinedFlowLayout
LinedFlowLayoutItemCollectionTransitionProvider
LinedFlowLayoutItemsInfoRequestedEventArgs
LinedFlowLayoutItemsJustification
LinedFlowLayoutItemsStretch
ScrollingAnchorRequestedEventArgs
ScrollingAnimationMode
ScrollingBringingIntoViewEventArgs
ScrollingChainMode
ScrollingContentOrientation
ScrollingInputKinds
ScrollingInteractionState
ScrollingRailMode
ScrollingScrollAnimationStartingEventArgs
ScrollingScrollBarVisibility
ScrollingScrollCompletedEventArgs
ScrollingScrollMode
ScrollingScrollOptions
ScrollingSnapPointsMode
ScrollingZoomAnimationStartingEventArgs
ScrollingZoomCompletedEventArgs
ScrollingZoomMode
ScrollingZoomOptions
ScrollView
TreeView
SelectionChanged
TreeViewSelectionChangedEventArgs
VirtualizingLayoutContext
VisibleRect
VisibleRectCore
Microsoft.UI.Xaml.Controls.Primitives
FlyoutBase
SystemBackdrop
SystemBackdropProperty
IScrollController
IScrollControllerPanningInfo
Popup
SystemBackdrop
SystemBackdropProperty
RepeatedScrollSnapPoint
RepeatedZoomSnapPoint
ScrollControllerAddScrollVelocityRequestedEventArgs
ScrollControllerPanRequestedEventArgs
ScrollControllerScrollByRequestedEventArgs
ScrollControllerScrollToRequestedEventArgs
ScrollPresenter
ScrollSnapPoint
ScrollSnapPointBase
ScrollSnapPointsAlignment
SnapPointBase
ZoomSnapPoint
ZoomSnapPointBase
Microsoft.UI.Xaml.Hosting
DesktopWindowXamlSource
DesktopWindowXamlSourceGotFocusEventArgs
DesktopWindowXamlSourceTakeFocusRequestedEventArgs
WindowsXamlManager
XamlSourceFocusNavigationReason
XamlSourceFocusNavigationRequest
XamlSourceFocusNavigationResult
版本 1.4 预览版 1 (1.4.0-preview1)
这是版本 1.4 的预览频道的最新版本。
在现有的 Windows 应用 SDK 1.3(来自稳定通道)应用中,您可以将 NuGet 包更新为 1.4.0-preview1(请参阅 使用 NuGet 包管理器在 Visual Studio 中安装和管理包的 更新包 部分)。
有关更新的运行时和 MSIX,请参阅 最新的 Windows 应用 SDK 下载。
小组件更新
为挂件提供程序添加了三个新接口来实现:IWidgetProvider2、IWidgetProviderAnalytics和 IWidgetProviderErrors。
IWidgetProvider2 允许提供程序响应用户调用的 自定义 操作,这与第一方小组件可用的操作相同。 提供商使用 IWidgetProviderAnalytics 和 IWidgetProviderErrors 接口收集其小组件的遥测信息;有关小组件的分析和故障事件将传达给相应的小组件提供商。
WidgetCustomizationRequestedArgs
WidgetAnalyticsInfoReportedArgs和WidgetErrorInfoReportedArgs类用于传达相关信息以支持新功能。
Windows 应用 SDK 中的新功能
- 允许 Win32 WinRT 应用检测系统高对比度设置何时发生更改的新
ThemeSettings类,类似于 UWP 的 AccessibilitySettings 类。 有关详细信息,请参阅 GitHub 上的 ThemeSettings API 规范 。 - 现在支持
Popup/FlyoutBase.ShouldConstrainToRootBounds,使工具提示、菜单和其他弹出窗口能够超出主窗口的边界。 预览版 1 尚未完全支持在弹出窗口/浮出控件上使用 Acrylic 或其他 SystemBackdrop,相关的 API 和实现将在下一个 1.4 版本中加入。 -
AccessKeyManager.EnterDisplayMode是一种新方法,用于显示指定根的当前聚焦元素的访问键。 当显示用于调用命令的键提示时,访问键处于“显示模式”,例如按 Paint 中的 Alt 键以显示与哪些控件对应的键。 此方法允许以编程方式进入显示模式。 -
Application.ResourceManagerRequested提供了一种机制,用于提供不同的IResourceManager,以便在默认ResourceManager不起作用时解析资源 URI。 有关详细信息,请参阅 GitHub 上的 Application.ResourceManagerRequested API 规范 。 - 我们引入了一个名为
ItemsView的新列表控件以及一个相应的具体ItemContainer类。ItemContainer是一个具有内置选择状态和视觉效果的轻型容器,可以轻松封装所需内容,并可与ItemsView一起用于集合控制场景。ItemsView在预览版 1 中仍标记为实验性,但将包含在下一个 1.4 版本中。 - WebView2 SDK 的版本从 1661.34 更新为 1823.32。
1.4.0-preview1 中的新 API
版本 1.4-preview1 包括与稳定 1.3 版本相比的以下新 API:
Microsoft.UI.System
ThemeSettings
Microsoft.UI.Xaml
Application
ResourceManagerRequested
ResourceManagerRequestedEventArgs
Microsoft.UI.Xaml.Automation.Peers
ItemContainerAutomationPeer
Microsoft.UI.Xaml.Controls
ItemContainer
Microsoft.UI.Xaml.Controls.Primitives
CommandBarFlyoutCommandBar
SystemBackdrop
SystemBackdropProperty
Microsoft.UI.Xaml.Input
AccessKeyManager
EnterDisplayMode
Microsoft.Web.WebView2.Core
CoreWebView2
LaunchingExternalUriScheme
MemoryUsageTargetLevel
CoreWebView2File
CoreWebView2LaunchingExternalUriSchemeEventArgs
CoreWebView2MemoryUsageTargetLevel
CoreWebView2PermissionKind
WindowManagement
CoreWebView2Profile
CookieManager
IsGeneralAutofillEnabled
IsPasswordAutosaveEnabled
CoreWebView2Settings
IsReputationCheckingRequired
CoreWebView2WebMessageReceivedEventArgs
AdditionalObjects
Microsoft.Windows.Widgets.Providers
IWidgetProvider2
IWidgetProviderAnalytics
IWidgetProviderErrors
WidgetAnalyticsInfoReportedArgs
WidgetCustomizationRequestedArgs
WidgetErrorInfoReportedArgs