Show / Hide Table of Contents

Class WindowManager

Manages Window size, and ensures window correctly resizes during DPI changes to keep consistent DPI-independent sizing.

Inheritance
System.Object
WindowManager
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: WinUIEx
Assembly: WinUIEx.dll
Syntax
public class WindowManager : IDisposable

Properties

| Improve this Doc View Source

AppWindow

Gets a reference to the AppWindow for the app

Declaration
public UI.Windowing.AppWindow AppWindow { get; }
Property Value
Type Description
Microsoft.UI.Windowing.AppWindow
| Improve this Doc View Source

Height

Gets or sets the height of the window.

Declaration
public double Height { get; set; }
Property Value
Type Description
System.Double

The window height in device independent pixels.

See Also
MinHeight
MaxHeight
| Improve this Doc View Source

IsAlwaysOnTop

Gets or sets a value indicating whether this window is always on top.

Declaration
public bool IsAlwaysOnTop { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsMaximizable

Gets or sets a value indicating whether the maximimze button is visible

Declaration
public bool IsMaximizable { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsMinimizable

Gets or sets a value indicating whether the minimize button is visible

Declaration
public bool IsMinimizable { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsResizable

Gets or sets a value indicating whether the window can be resized.

Declaration
public bool IsResizable { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsTitleBarVisible

Gets or sets a value indicating whether the default title bar is visible or not.

Declaration
public bool IsTitleBarVisible { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsVisibleInTray

Gets or sets a value indicating whether the window is shown in the system tray.

Declaration
public bool IsVisibleInTray { get; set; }
Property Value
Type Description
System.Boolean
Remarks

The system tray icon will use the same icon as Window's Taskbar icon, and tooltip will match the AppWindow.Title value. Double-clicking the icon restores the window if minimized and brings it to the front.

See SetIsShownInSwitchers(UI.Xaml.Window, Boolean) to hide the window from the Alt+Tab switcher and task bar. If you want to minimize the window to the tray, set this to true and when WindowStateChanged is fired and changes to minimized, hide it from the switcher.

| Improve this Doc View Source

MaxHeight

Gets or sets the maximum height of this window

Declaration
public double MaxHeight { get; set; }
Property Value
Type Description
System.Double

The maximum window height in device independent pixels.

Remarks

The default is 0, which means no limit. If the value is less than MinHeight, the MinHeight will also be used as the maximum height.

See Also
MaxWidth
MinHeight
| Improve this Doc View Source

MaxWidth

Gets or sets the maximum width of this window

Declaration
public double MaxWidth { get; set; }
Property Value
Type Description
System.Double

The maximum window width in device independent pixels.

Remarks

The default is 0, which means no limit. If the value is less than MinWidth, the MinWidth will also be used as the maximum width.

See Also
MaxHeight
MinWidth
| Improve this Doc View Source

MinHeight

Gets or sets the minimum height of this window

Declaration
public double MinHeight { get; set; }
Property Value
Type Description
System.Double

The minimum window height in device independent pixels.

Remarks

A window is currently set to a minimum of 39 pixels.

See Also
MaxHeight
MinWidth
| Improve this Doc View Source

MinWidth

Gets or sets the minimum width of this window

Declaration
public double MinWidth { get; set; }
Property Value
Type Description
System.Double

The minimum window width in device independent pixels.

Remarks

A window is currently set to a minimum of 139 pixels.

See Also
MaxWidth
MinHeight
| Improve this Doc View Source

PersistenceId

Declaration
public string PersistenceId { get; set; }
Property Value
Type Description
System.String
Remarks

The ID must be set before the window activates. The window size and position will only be restored if the monitor layout hasn't changed between application settings. The property uses ApplicationData storage, and therefore is currently only functional for packaged applications. By default the property uses storage, and therefore is currently only functional for packaged applications. If you're using an unpackaged application, you must also set the PersistenceStorage property and manage persisting this across application settings.

See Also
PersistenceStorage
| Improve this Doc View Source

PersistenceStorage

Gets or sets the persistence storage for maintaining window settings across application settings.

Declaration
public static IDictionary<string, object> PersistenceStorage { get; set; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, System.Object>
Remarks

For a packaged application, this will be initialized automatically for you, and saved with the application identity using . However for an unpackaged application, you will need to set this and serialize the property to/from disk between application sessions. The provided dictionary is automatically written to when the window closes, and should be initialized before any window with persistence opens.

See Also
PersistenceId
| Improve this Doc View Source

PresenterKind

Gets or sets the presenter kind for the current window

Declaration
public UI.Windowing.AppWindowPresenterKind PresenterKind { get; set; }
Property Value
Type Description
Microsoft.UI.Windowing.AppWindowPresenterKind
See Also
PresenterChanged
| Improve this Doc View Source

Width

Gets or sets the width of the window.

Declaration
public double Width { get; set; }
Property Value
Type Description
System.Double

The window width in device independent pixels.

See Also
MinWidth
MaxWidth
| Improve this Doc View Source

WindowState

Gets or sets the current window state.

Declaration
public WindowState WindowState { get; set; }
Property Value
Type Description
WindowState

A WindowState that determines whether a window is restored, minimized, or maximized. The default is Normal (restored).

Remarks

When the WindowState property is changed, WindowStateChanged is raised.

note

This property only has affect when using the OverlappedPresenter.

See Also
WindowStateChanged
PresenterKind

Methods

| Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
| Improve this Doc View Source

Finalize()

Finalizer

Declaration
protected void Finalize()
| Improve this Doc View Source

Get(Window)

Gets (or creates) a window manager for the specific window.

Declaration
public static WindowManager Get(Window window)
Parameters
Type Name Description
Window window
Returns
Type Description
WindowManager

Events

| Improve this Doc View Source

PositionChanged

Raised if the window position changes.

Declaration
public event EventHandler<Graphics.PointInt32> PositionChanged
Event Type
Type Description
System.EventHandler<Windows.Graphics.PointInt32>
| Improve this Doc View Source

PresenterChanged

Raised if the presenter for the window changes.

Declaration
public event EventHandler<AppWindowPresenter> PresenterChanged
Event Type
Type Description
System.EventHandler<AppWindowPresenter>
| Improve this Doc View Source

WindowMessageReceived

Event raised when a windows message is received.

Declaration
public event EventHandler<WindowMessageEventArgs> WindowMessageReceived
Event Type
Type Description
System.EventHandler<WindowMessageEventArgs>
| Improve this Doc View Source

WindowStateChanged

Occurs when the window's WindowState property changes.

Declaration
public event EventHandler<WindowState> WindowStateChanged
Event Type
Type Description
System.EventHandler<WindowState>
Remarks
note

This event only has affect when using the OverlappedPresenter.

See Also
WindowState
PresenterChanged
| Improve this Doc View Source

ZOrderChanged

Raised if the Z order of the window changes.

Declaration
public event EventHandler<ZOrderInfo> ZOrderChanged
Event Type
Type Description
System.EventHandler<ZOrderInfo>

Implements

System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX