Represents a system-managed container for the content of an app.
public ref class AppWindow sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 524288)] /// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] /// [Windows.Foundation.Metadata.Static(Windows.UI.WindowManagement.IAppWindowStatics, 524288, "Windows.Foundation.UniversalApiContract")] /// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] /// [Windows.Foundation.Metadata.WebHostHidden] class AppWindow sealed
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 524288)] [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] [Windows.Foundation.Metadata.Static(typeof(Windows.UI.WindowManagement.IAppWindowStatics), 524288, "Windows.Foundation.UniversalApiContract")] [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] [Windows.Foundation.Metadata.WebHostHidden] public sealed class AppWindow
Public NotInheritable Class AppWindow
Windows 10 requirements
Windows 10, version 1903 (introduced in 10.0.18362.0)
Windows.Foundation.UniversalApiContract (introduced in v8.0)
AppWindow is currently in preview. This means you can submit apps that use AppWindow to the Store, but some platform and framework components are known to not work with AppWindow (see Limitations).
An AppWindow can be used to represent a displayed portion of a Windows Runtime app when it has more than one window. It is similar in concept to an ApplicationView, but not the same in behavior and lifetime.
To obtain an object of this type, call AppWindow.TryCreateAsync.
To connect content to your AppWindow, call ElementCompositionPreview.SetAppWindowContent.
You can only connect XAML content to your AppWindow, there is no support for native DirectX or Holographic content.
To specify a preferred minimum size for the app window, use the WindowManagementPreview.SetPreferredMinSize method.
A sample that shows how to use the AppWindow API can be found in the Windows Universal Samples repo on GitHub under Samples/AppWindow.
Limitations in the current preview version of AppWindow include (this is a non-exhaustive list):
- Any API that uses the GetForCurrentView pattern is not working for AppWindow since the CurrentView refers to the ApplicationView which is a separate entity from the AppWindow.
- Fullscreen media playback is unavailable in MediaElement or MediaPlayerElement.
- MessageDialog will not be modal to the correct window, recommendation is to use ContentDialog instead.
- WebView is not fully supported. You can use an in-proc WebView, but anything outside of static HTML content may or may not work properly.
- If you set the Window.Current.Content property in XAML, it destroys all the XAML content in your AppWindow. Avoid using this as a pattern to reset your content when suspending your app if you use AppWindow.
- Smooth Window Resize is not working for AppWindows. The frame and the content will resize independently, which can look unpolished when content layout is slow.
- DisplayInformation is not accessible for AppWindow. If your AppWindow is on a different monitor than your ApplicationView you will not be able to query for the correct display information.
- UserInteractionMode cannot be set for an AppWindow.
- Print dialogs (2D and 3D) will not be parented to the correct window.
- AppWindow cannot detect when edge gestures are being invoked.
- AppWindow cannot be used to satisfy an activation request through ActivationViewSwitcher.
Gets the app content currently attached to the window.
Gets the dispatcher queue for the app window.
Gets the frame for the app window.
Gets a value that indicates whether the window can be seen on a display.
Gets or sets a string that identifies this window for tracking and saving state.
Gets the presenter for the app window.
Gets or sets the displayed title of the app window.
Gets the title bar of the app window.
Gets the UI context for the app window.
Gets the windowing environment for the app window.
Clears any properties the system has saved for any window PersistedStateId for the given application.
Clears any properties the system has saved for the window with the specified ID for the given application.
Closes the app window.
Returns the collection of display regions available for the app window.
Returns a placement object that describes the app window's display region, offset, and size.
Makes a request to position the window next to the current view.
Makes a request to position the window next to the specified anchor window.
Makes a request to position the window at the specified offset relative to the current view.
Makes a request to position the window in the specified display region at the specified offset.
Makes a request to position the window at the specified offset relative to the anchor window.
Makes a request to position the window in the specified display region.
Makes a request to set the window to the specified size.
Attempts to asynchronously create a new instance of AppWindow.
Attempts to asynchronously show the current app window.
Occurs when a property of the app window has changed.
Occurs when the app window has been closed.
Occurs after the window starts to close, but before it is closed and before the Closed event occurs.