Class WindowManager
Manages Window size, and ensures window correctly resizes during DPI changes to keep consistent DPI-independent sizing.
Inheritance
Implements
Inherited Members
Namespace: WinUIEx
Assembly: WinUIEx.dll
Syntax
public class WindowManager : IDisposable
Properties
| Improve this Doc View SourceAppWindow
Gets a reference to the AppWindow for the app
Declaration
public UI.Windowing.AppWindow AppWindow { get; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Windowing.AppWindow |
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
| Improve this Doc View SourceIsAlwaysOnTop
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 |
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 |
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 |
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 |
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 |
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
| Improve this Doc View SourceMaxWidth
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
| Improve this Doc View SourceMinHeight
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
| Improve this Doc View SourceMinWidth
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
| Improve this Doc View SourcePersistenceId
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
See Also
| Improve this Doc View SourcePersistenceStorage
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
See Also
| Improve this Doc View SourcePresenterKind
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
| Improve this Doc View SourceWidth
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
| Improve this Doc View SourceWindowState
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
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
Finalize()
Finalizer
Declaration
protected void Finalize()
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 SourcePositionChanged
Raised if the window position changes.
Declaration
public event EventHandler<Graphics.PointInt32> PositionChanged
Event Type
Type | Description |
---|---|
System.EventHandler<Windows.Graphics.PointInt32> |
PresenterChanged
Raised if the presenter for the window changes.
Declaration
public event EventHandler<AppWindowPresenter> PresenterChanged
Event Type
Type | Description |
---|---|
System.EventHandler<AppWindowPresenter> |
WindowMessageReceived
Event raised when a windows message is received.
Declaration
public event EventHandler<WindowMessageEventArgs> WindowMessageReceived
Event Type
Type | Description |
---|---|
System.EventHandler<WindowMessageEventArgs> |
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
| Improve this Doc View SourceZOrderChanged
Raised if the Z order of the window changes.
Declaration
public event EventHandler<ZOrderInfo> ZOrderChanged
Event Type
Type | Description |
---|---|
System.EventHandler<ZOrderInfo> |