Table of Contents

Interface IWindowImpl

Namespace
Avalonia.Platform
Assembly
Avalonia.Controls.dll

Defines a platform-specific window implementation.

[Unstable]
public interface IWindowImpl : IWindowBaseImpl, ITopLevelImpl, IOptionalFeatureProvider, IDisposable
Inherited Members

Properties

Closing

Gets or sets a method called before the underlying implementation is destroyed. Return true to prevent the underlying implementation from closing.

Func<WindowCloseReason, bool>? Closing { get; set; }

Property Value

Func<WindowCloseReason, bool>

ExtendClientAreaToDecorationsChanged

Gets or Sets an action that is called whenever one of the extend client area properties changed.

Action<bool>? ExtendClientAreaToDecorationsChanged { get; set; }

Property Value

Action<bool>

ExtendedMargins

Gets a thickness that describes the amount each side of the non-client area extends into the client area. It includes the titlebar.

Thickness ExtendedMargins { get; }

Property Value

Thickness

GotInputWhenDisabled

Called when a disabled window received input. Can be used to activate child windows.

Action? GotInputWhenDisabled { get; set; }

Property Value

Action

IsClientAreaExtendedToDecorations

Gets a value to indicate if the platform was able to extend client area to non-client area.

bool IsClientAreaExtendedToDecorations { get; }

Property Value

bool

NeedsManagedDecorations

Gets a flag that indicates if Managed decorations i.e. caption buttons are required. This property is used when IsClientAreaExtendedToDecorations is set.

bool NeedsManagedDecorations { get; }

Property Value

bool

OffScreenMargin

Gets a thickness that describes the margin around the window that is offscreen. This may happen when a window is maximized and IsClientAreaExtendedToDecorations is set.

Thickness OffScreenMargin { get; }

Property Value

Thickness

WindowState

Gets or sets the minimized/maximized state of the window.

WindowState WindowState { get; set; }

Property Value

WindowState

WindowStateChanged

Gets or sets a method called when the minimized/maximized state of the window changes.

Action<WindowState>? WindowStateChanged { get; set; }

Property Value

Action<WindowState>

Methods

BeginMoveDrag(PointerPressedEventArgs)

Starts moving a window with left button being held. Should be called from left mouse button press event handler.

void BeginMoveDrag(PointerPressedEventArgs e)

Parameters

e PointerPressedEventArgs

BeginResizeDrag(WindowEdge, PointerPressedEventArgs)

Starts resizing a window. This function is used if an application has window resizing controls. Should be called from left mouse button press event handler

void BeginResizeDrag(WindowEdge edge, PointerPressedEventArgs e)

Parameters

edge WindowEdge
e PointerPressedEventArgs

CanResize(bool)

Enables or disables resizing of the window

void CanResize(bool value)

Parameters

value bool

GetWindowsZOrder(Span<Window>, Span<long>)

Fills zOrder with numbers that represent the relative order of the windows in the z-order. The topmost window should have the highest number. Both the windows and zOrder lists are expected to be the same length.

void GetWindowsZOrder(Span<Window> windows, Span<long> zOrder)

Parameters

windows Span<Window>

A span of windows to get their z-order

zOrder Span<long>

Span to be filled with associated window z-order

Move(PixelPoint)

Sets the client size of the top level.

void Move(PixelPoint point)

Parameters

point PixelPoint

Resize(Size, WindowResizeReason)

Sets the client size of the top level.

void Resize(Size clientSize, WindowResizeReason reason = WindowResizeReason.Application)

Parameters

clientSize Size

The new client size.

reason WindowResizeReason

The reason for the resize.

SetEnabled(bool)

Disables the window for example when a modal dialog is open.

void SetEnabled(bool enable)

Parameters

enable bool

true if the window is enabled, or false if it is disabled.

SetExtendClientAreaChromeHints(ExtendClientAreaChromeHints)

Sets hints that configure how the client area extends.

void SetExtendClientAreaChromeHints(ExtendClientAreaChromeHints hints)

Parameters

hints ExtendClientAreaChromeHints

SetExtendClientAreaTitleBarHeightHint(double)

Sets how big the non-client titlebar area should be.

void SetExtendClientAreaTitleBarHeightHint(double titleBarHeight)

Parameters

titleBarHeight double

-1 for platform default, otherwise the height in DIPs.

SetExtendClientAreaToDecorationsHint(bool)

Sets if the ClientArea is extended into the non-client area.

void SetExtendClientAreaToDecorationsHint(bool extendIntoClientAreaHint)

Parameters

extendIntoClientAreaHint bool

true to enable, false to disable

SetIcon(IWindowIconImpl?)

Sets the icon of this window.

void SetIcon(IWindowIconImpl? icon)

Parameters

icon IWindowIconImpl

SetMinMaxSize(Size, Size)

Minimum width of the window.

void SetMinMaxSize(Size minSize, Size maxSize)

Parameters

minSize Size
maxSize Size

SetParent(IWindowImpl?)

Sets the parent of the window.

void SetParent(IWindowImpl? parent)

Parameters

parent IWindowImpl

The parent IWindowImpl.

SetSystemDecorations(SystemDecorations)

Enables or disables system window decorations (title bar, buttons, etc)

void SetSystemDecorations(SystemDecorations enabled)

Parameters

enabled SystemDecorations

SetTitle(string?)

Sets the title of the window.

void SetTitle(string? title)

Parameters

title string

The title.

ShowTaskbarIcon(bool)

Enables or disables the taskbar icon

void ShowTaskbarIcon(bool value)

Parameters

value bool