Skip to main content

SizeToContent Property

Gets or sets a value indicating how the window will size itself to fit its content.

Definition

Namespace: Avalonia.Controls
Assembly: Avalonia.Controls (in Avalonia.Controls.dll)

public SizeToContent SizeToContent { get; set; }

Property Value

SizeToContent

Remarks

If SizeToContent has a value other than Manual, SizeToContent is automatically set to Manual if a user resizes the window by using the resize grip or dragging the border. NOTE: Because of a limitation of X11, SizeToContent will be reset on X11 to Manual on any resize - including the resize that happens when the window is first shown. This is because X11 resize notifications are asynchronous and there is no way to know whether a resize came from the user or the layout system. To avoid this, consider setting CanResize to false, which will disable user resizing of the window.

See Also

Reference

Window Class
Avalonia.Controls Namespace