Skip to main content

BackgroundSizing Enum

Definition

Namespace:Avalonia.Media
Assembly:Avalonia.Base
Package:Avalonia

Defines how a background is drawn relative to its border.

public enum BackgroundSizing

Inheritance: Enum -> BackgroundSizing

Fields

NameDescription
CenterBorderThe background is drawn to the midpoint (center) of the border.
InnerBorderEdgeThe background is drawn up to the inside edge of the border.
OuterBorderEdgeThe background is drawn completely to the outside edge of the border.

CenterBorder Field

The background is drawn to the midpoint (center) of the border.

public Avalonia.Media.BackgroundSizing CenterBorder

Remarks

The background will be visible underneath half of the border if the border has transparency. For this reason it is not recommended to use Avalonia.Media.BackgroundSizing.CenterBorder if transparency is involved.

This value does not exist in other XAML frameworks and only exists in Avalonia for backwards compatibility with legacy code. Before Avalonia.Media.BackgroundSizing was added, Avalonia would always render using this value (Skia's default).

InnerBorderEdge Field

The background is drawn up to the inside edge of the border.

public Avalonia.Media.BackgroundSizing InnerBorderEdge

Remarks

The background will never be drawn under the border itself and will not be visible underneath the border regardless of border transparency.

OuterBorderEdge Field

The background is drawn completely to the outside edge of the border.

public Avalonia.Media.BackgroundSizing OuterBorderEdge

Remarks

The background will be visible underneath the border if the border has transparency.