Upravit

Sdílet prostřednictvím


Mapping UWP APIs and libraries to the Windows App SDK

This topic provides a mapping of UWP APIs to their Windows App SDK equivalents. In some cases the mapping isn't one-to-one; either platform might have more or less functionality than the other for a namespace or class.

There are differences in the names of namespaces and classes (including UI controls) between the two platforms. In many cases, it's as easy as changing a namespace name and then your code will compile. Sometimes, a class or API name has changed as well as the namespace name. Other times, the mapping takes a bit more work, and in rare cases requires a change in approach.

How to use the table. First, search for the name of the class member you're using. Members are listed whenever the mapping is more complicated than a simple class name or namespace name change. If your member isn't listed, then search for the name of the class you're using. Classes are listed whenever the mapping is more complicated than simply changing the namespace name (for specific guidance, see the Feature area guides). If your class isn't listed, then the mapping is just a namespace change. So, find your class's namespace name and then you'll find the equivalent Windows App SDK namespace name. Your class will be in that namespace. If your namespace isn't listed, then its name hasn't changed.

UWP Windows App SDK
(Windows.ApplicationModel.Activation) LaunchActivatedEventArgs class (Microsoft.UI.Xaml) LaunchActivatedEventArgs class; for example, in App.OnLaunched.
(Windows.ApplicationModel.Core) CoreApplication.CreateNewView method (Microsoft.UI.Windowing) AppWindow.Create method
(Windows.ApplicationModel.Core) CoreApplicationViewTitleBar class (Microsoft.UI.Windowing) AppWindowTitleBar class
(Windows.ApplicationModel.Core) CoreApplicationViewTitleBar.ExtendViewIntoTitleBar property (Microsoft.UI.Windowing) AppWindowTitleBar.ExtendsContentIntoTitleBar property. The platform continues to draw the Minimize/Maximize/Close buttons for you, and reports the occlusion information.
(Windows.ApplicationModel.Core) CoreApplicationViewTitleBar.Height property (Microsoft.UI.Windowing) AppWindowTitleBar.Height property
(Windows.ApplicationModel.Core) CoreApplicationViewTitleBar.SystemOverlayLeftInset property (Microsoft.UI.Windowing) AppWindowTitleBar.LeftInset property
(Windows.ApplicationModel.Core) CoreApplicationViewTitleBar.SystemOverlayRightInset property (Microsoft.UI.Windowing) AppWindowTitleBar.RightInset property
Windows.ApplicationModel.Resources.Core namespace Microsoft.Windows.ApplicationModel.Resources. See MRT to MRT Core migration.
(Windows.ApplicationModel.Resources.Core) ResourceContext.GetForCurrentView method (Microsoft.Windows.ApplicationModel.Resources) ResourceManager.CreateResourceContext method. See ResourceContext.GetForCurrentView, and ResourceContext.GetForViewIndependentUse.
(Windows.ApplicationModel.Resources.Core) ResourceContext.GetForViewIndependentUse method (Microsoft.Windows.ApplicationModel.Resources) ResourceManager.CreateResourceContext method. See ResourceContext.GetForCurrentView, and ResourceContext.GetForViewIndependentUse.
(Windows.ApplicationModel.Resources.Core) ResourceManager.Current property Create a new (Microsoft.Windows.ApplicationModel.Resources) ResourceManager object. See ResourceManager class.
(Windows.ApplicationModel.Resources.Core) ResourceQualifierObservableMap.MapChanged event Detect environment changes for yourself. See Resource qualifier value change.
(Windows.Graphics.Printing) PrintManager class Not supported in Windows App SDK 1.0.
(Windows.Media.Capture) CameraCaptureUI class Not supported in Windows App SDK 1.0.
(Windows.Security.Authentication.Web) WebAuthenticationBroker class Not supported in Windows App SDK 1.0.
(Windows.Storage.Pickers) FileOpenPicker, FileSavePicker, and FolderPicker classes Supported, but you must use the IInitializeWithWindow interface. See MessageDialog, and Pickers.
(Windows.System.Display) DisplayRequest class Not supported in Windows App SDK 1.0.
Windows.UI.Composition namespace Microsoft.UI.Composition namespace
(Windows.UI.Core) CoreDispatcher class (Microsoft.UI.Dispatching) DispatcherQueue class. See Change CoreDispatcher to DispatcherQueue.
(Windows.UI.Core) CoreDispatcher.RunAsync method (Microsoft.UI.Dispatching) DispatcherQueue.TryEnqueue method. See Change RunAsync to TryEnqueue.
(Windows.UI.Core) CoreWindow class (Microsoft.UI.Windowing) AppWindow class. See Windowing functionality migration.
(Windows.UI.Core) CoreWindow.Bounds property (commonly appears in C# as CoreWindow.GetForCurrentThread.Bounds) (Microsoft.UI.Windowing) AppWindow.Size property
(Windows.UI.Core) CoreWindow.GetForCurrentThread method No direct 1:1 mapping to a Windows App SDK API. When using XAML, you can get Window.AppWindow to get the AppWindow associated with a XAML Window, but an app needs to cache the Window or AppWindow if it wants to access it from somewhere that doesn't otherwise have access. We recommend caching and exposing the Window on the App object.
(Windows.UI.Core) CoreWindow.Activate method (Microsoft.UI.Windowing) AppWindow.Show method
(Windows.UI.Core) CoreWindow.Dispatcher property (Microsoft.UI.Xaml) Window.DispatcherQueue property. See Change CoreWindow.Dispatcher to Window.DispatcherQueue.
(Windows.UI.Core) CoreWindow.SizeChanged event (Microsoft.UI.Windowing) AppWindowChangedEventArgs.DidSizeChange method
(Windows.UI.Core) SystemNavigationManager class (global back button) Not supported. Implement a back button within your own UI. See A Windows App SDK migration of the UWP PhotoLab sample app (C#).
(Windows.UI.Core) WindowSizeChangedEventArgs class (Microsoft.UI.Xaml) WindowSizeChangedEventArgs class; for example, in a handler for (Microsoft.UI.Xaml) Window.SizeChanged.
(Windows.UI.Popups) MessageDialog class Supported, but you must use the IInitializeWithWindow interface. See MessageDialog, and Pickers.
(Windows.UI.Text.Core) CoreTextServicesManager class Supported only on Windows 11.
(Windows.UI.ViewManagement) ApplicationView class (Microsoft.UI.Windowing) AppWindow class
(Windows.UI.ViewManagement) ApplicationView.Title property (Microsoft.UI.Windowing) AppWindow.Title property
(Windows.UI.ViewManagement) ApplicationView.TryConsolidateAsync method (Microsoft.UI.Windowing) AppWindow.Destroy method
(Windows.UI.ViewManagement) ApplicationView.TryEnterFullScreenMode method (Microsoft.UI.Windowing) AppWindow.SetPresenter method with AppWindowPresenterKind.FullScreen
(Windows.UI.ViewManagement) ApplicationView.TryEnterViewModeAsync method with ApplicationViewMode.CompactOverlay (Microsoft.UI.Windowing) AppWindow.SetPresenter method with AppWindowPresenterKind.CompactOverlay
(Windows.UI.ViewManagement) ApplicationView.TryResizeView method (Microsoft.UI.Windowing) AppWindow.Resize method
(Windows.UI.ViewManagement) ApplicationViewMode.CompactOverlay field (Microsoft.UI.Windowing) AppWindowPresenterKind.CompactOverlay field
(Windows.UI.ViewManagement) ApplicationViewTitleBar class (Microsoft.UI.Windowing) AppWindowTitleBar class
(Windows.UI.ViewManagement) ApplicationViewWindowingMode.FullScreen field (Microsoft.UI.Windowing) AppWindowPresenterKind.FullScreen field
(Windows.UI.WindowManagement) AppWindow class (Microsoft.UI.Windowing) AppWindow class
(Windows.UI.WindowManagement) AppWindow.Changed event (Microsoft.UI.Windowing) Microsoft.UI.Windowing.AppWindow.Changed event
(Windows.UI.WindowManagement) AppWindow.CloseAsync method (Microsoft.UI.Windowing) AppWindow.Destroy method
(Windows.UI.WindowManagement) AppWindow.GetPlacement method (Microsoft.UI.Windowing) AppWindow.Position property
(Windows.UI.WindowManagement) Appwindow.RequestMoveXxx methods (Microsoft.UI.Windowing) AppWindow.Move method
(Windows.UI.WindowManagement) AppWindow.RequestSize method (Microsoft.UI.Windowing) AppWindow.Resize method
(Windows.UI.WindowManagement) AppWindow.Title property (Microsoft.UI.Windowing) AppWindow.Title property
(Windows.UI.WindowManagement) AppWindow.TryCreateAsync method (Microsoft.UI.Windowing) AppWindow.Create method
(Windows.UI.WindowManagement) AppWindow.TryShowAsync method (Microsoft.UI.Windowing) AppWindow.Show method
(Windows.UI.WindowManagement) AppWindowChangedEventArgs.DidSizeChange method (Microsoft.UI.Windowing) AppWindowChangedEventArgs.DidSizeChange method
(Windows.UI.WindowManagement) AppWindowPlacement.Size property (Microsoft.UI.Windowing) AppWindow.Size property
(Windows.UI.WindowManagement) AppWindowPresentationKind.CompactOverlay field (Microsoft.UI.Windowing) AppWindowPresenterKind.CompactOverlay field
(Windows.UI.WindowManagement) AppWindowPresentationKind.FullScreen field (Microsoft.UI.Windowing) AppWindowPresenterKind.FullScreen field
(Windows.UI.WindowManagement) AppWindowPresenter.RequestPresentation method (Microsoft.UI.Windowing) AppWindow.SetPresenter method
(Windows.UI.WindowManagement) AppWindowTitleBar class (Microsoft.UI.Windowing) AppWindowTitleBar class
(Windows.UI.WindowManagement) AppWindowTitleBar.GetPreferredVisibility No direct 1:1 mapping to a Windows App SDK API
(Windows.UI.WindowManagement) AppWindowTitleBar.GetTitleBarOcclusions (Microsoft.UI.Windowing) AppWindowTitleBar.LeftInset and RightInset, coupled with Height, provide the same information.
(Windows.UI.WindowManagement) AppWindowTitleBar.SetPreferredVisibility No direct 1:1 mapping to a Windows App SDK API
(Windows.UI.WindowManagement) AppWindowTitleBarOcclusion property (Microsoft.UI.Windowing) AppWindowTitleBar.LeftInset and RightInset, coupled with Height, provide the same information.
(Windows.UI.WindowManagement) AppWindowTitleBarVisibility No direct 1:1 mapping to a Windows App SDK API
Windows.UI.Xaml namespace Microsoft.UI.Xaml namespace
(Windows.UI.Xaml) Application.OnActivated method (commonly appears in C# as App.OnActivated) See OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Application.OnBackgroundActivated method (commonly appears in C# as App.OnBackgroundActivated) See OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Application.OnCachedFileUpdaterActivated method (commonly appears in C# as App.OnCachedFileUpdaterActivated) See OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Application.OnFileActivated method (commonly appears in C# as App.OnFileActivated) See File type association and OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Application.OnFileOpenPickerActivated method (commonly appears in C# as App.OnFileOpenPickerActivated) See OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Application.OnFileSavePickerActivated method (commonly appears in C# as App.OnFileSavePickerActivated) See OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Application.OnSearchActivated method (commonly appears in C# as App.OnSearchActivated) See OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Application.OnShareTargetActivated method (commonly appears in C# as App.OnShareTargetActivated) See OnActivated, OnBackgroundActivated, and other activation-handling methods.
(Windows.UI.Xaml) Window.Current property Deprecated, and returns null. For an alternative, see Change Window.Current to App.Window.
(Windows.UI.Xaml) Window.Dispatcher property (commonly written in C# as Window.Current.Dispatcher) (Microsoft.UI.Xaml) Window.DispatcherQueue property
(Windows.UI.Xaml.Controls) ContentDialog class (Microsoft.UI.Xaml.Controls) ContentDialog is supported, but you must set its XamlRoot property. See ContentDialog, and Popup.
(Windows.UI.Xaml.Controls) InkCanvas class Not supported in Windows App SDK 1.0.
(Windows.UI.Xaml.Controls) MediaElement class Not supported in Windows App SDK 1.0.
(Windows.UI.Xaml.Controls.Maps) MapControl class (Microsoft.UI.Xaml.Controls) MapControl class
(Windows.UI.Xaml.Controls.Primitives) Popup class (Microsoft.UI.Xaml.Controls.Primitives) Popup is supported, but you must set its XamlRoot property. See ContentDialog, and Popup.
(Windows.UI.Xaml.Media) AcrylicBrush.BackgroundSource property In the Windows App SDK, the (Microsoft.UI.Xaml.Media) AcrylicBrush always samples from the app content. See AcrylicBrush.BackgroundSource property.
C++/WinRT. co_await winrt.resume_foreground(this->Dispatcher()); See Migrate winrt.resume_foreground

Third-party libraries

This section documents various libraries that were supported in UWP, and need to be changed when using WinUI 3.

UWP Windows App SDK
OneDrive SDK Microsoft Graph SDK

See Also