AppWindow Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a system-managed container for the content of an app.
public ref class AppWindow sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class AppWindow final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class AppWindow
Public NotInheritable Class AppWindow
- Inheritance
- Attributes
Remarks
Important
Title bar customization APIs are partially supported on Windows 10 since Windows App SDK 1.2 and fully supported on Windows 11. You should check AppWindowTitleBar.IsCustomizationSupported in your code before you call these APIs to ensure your app doesn't crash on other versions of Windows. See Title bar customization for more info.
Properties
ClientSize |
Gets the current size of the window's client area in Win32 client coordinates. |
DispatcherQueue |
Gets the dispatcher queue associated with the app window. |
Id |
Gets the identifier for the app window. |
IsShownInSwitchers |
Gets or sets a value that indicates whether this window will appear in various system representations, such as ALT+TAB and taskbar. |
IsVisible |
Gets a value that indicates whether the window is shown. |
OwnerWindowId |
Gets the identifier of the owner of this window; or 0 if not owned. |
Position |
Gets the current position of the window in screen coordinates. |
Presenter |
Gets the currently applied presenter for the app window. |
Size |
Gets the current size of the window in screen coordinates. |
Title |
Gets or sets the displayed title of the app window. |
TitleBar |
Gets the title bar of the app window. |
Methods
AssociateWithDispatcherQueue(DispatcherQueue) |
Associates the app window with the specified dispatcher queue. |
Create() |
Creates an app window with the styles and properties set to that of the default |
Create(AppWindowPresenter, WindowId, DispatcherQueue) |
Creates a window with styles and properties as defined in the specified |
Create(AppWindowPresenter, WindowId) |
Creates a window with styles and properties as defined in the specified |
Create(AppWindowPresenter) |
Creates a window with styles and properties as defined in the specified |
Destroy() |
Attempts to destroy the app window. |
GetFromWindowId(WindowId) |
Returns the |
Hide() |
Hides the window from all UX representations in the system but keeps the object alive. |
Move(PointInt32) |
Moves the window to the specified point in screen coordinates. |
MoveAndResize(RectInt32, DisplayArea) |
Moves the window to the specified point within the given display area and sets it to the specified size. |
MoveAndResize(RectInt32) |
Moves the window to the specified point in screen coordinates and sets it to the specified size. |
MoveInZOrderAtBottom() |
Moves the current window to be the bottom window in the Z-order. |
MoveInZOrderAtTop() |
Moves the current window to be the top window in the Z-order. |
MoveInZOrderBelow(WindowId) |
Moves the current window to be below the specified window in the Z-order. |
Resize(SizeInt32) |
Resizes the window to the specified size. |
ResizeClient(SizeInt32) |
Resizes the window to accommodate the specified size for the client area. |
SetIcon(IconId) |
Sets the icon for the window, using the specified icon ID. |
SetIcon(String) |
Sets the icon for the window, using the specified icon path. |
SetPresenter(AppWindowPresenter) |
Applies the specified presenter to the window. |
SetPresenter(AppWindowPresenterKind) |
Applies the specified presenter kind to the window. |
Show() |
Shows the window and activates it. |
Show(Boolean) |
Shows the window with an option to activate it or not. |
ShowOnceWithRequestedStartupState() |
Shows the window with the default presenter in the requested state. |
Events
Changed |
Occurs when a property of the window has changed, and the system is in a "steady state" for the time being. |
Closing |
Occurs when a window is being closed through a system affordance. |
Destroying |
Occurs when a window is being destroyed. |