Table of Contents

Class Rectangle

Namespace
Avalonia.Controls.Shapes
Assembly
Avalonia.Controls.dll

Represents a rectangle with optional rounded corners.

public class Rectangle : Shape, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
Inheritance
Rectangle
Implements
Inherited Members
Extension Methods

Constructors

Rectangle()

public Rectangle()

Fields

RadiusXProperty

Defines the RadiusX property.

public static readonly StyledProperty<double> RadiusXProperty

Field Value

StyledProperty<double>

RadiusYProperty

Defines the RadiusY property.

public static readonly StyledProperty<double> RadiusYProperty

Field Value

StyledProperty<double>

Properties

RadiusX

Gets or sets the radius on the X-axis used to round the corners of the rectangle. Corner radii are represented by an ellipse so this is the X-axis width of the ellipse.

public double RadiusX { get; set; }

Property Value

double

Remarks

In order for this property to be used, Rect must not be set (equal to the default Rect value).

RadiusY

Gets or sets the radius on the Y-axis used to round the corners of the rectangle. Corner radii are represented by an ellipse so this is the Y-axis height of the ellipse.

public double RadiusY { get; set; }

Property Value

double

Remarks

In order for this property to be used, Rect must not be set (equal to the default Rect value).

Methods

CreateDefiningGeometry()

Creates the shape's defining geometry.

protected override Geometry CreateDefiningGeometry()

Returns

Geometry

Defining Geometry of the shape.

MeasureOverride(Size)

Measures the control and its child elements as part of a layout pass.

protected override Size MeasureOverride(Size availableSize)

Parameters

availableSize Size

The size available to the control.

Returns

Size

The desired size for the control.