Skip to main content

RectangleGeometry Class

Definition

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

Represents the geometry of a rectangle.

public class RectangleGeometry

Inheritance: object -> AvaloniaObject -> Geometry -> RectangleGeometry

Constructors

NameDescription
RectangleGeometry (3 overloads)Initializes a new instance of the Avalonia.Media.RectangleGeometry class.

RectangleGeometry overloads

RectangleGeometry Constructor

Initializes a new instance of the Avalonia.Media.RectangleGeometry class.

public RectangleGeometry()

RectangleGeometry Constructor

Initializes a new instance of the Avalonia.Media.RectangleGeometry class.

public RectangleGeometry(Avalonia.Rect rect)
Parameters

rect Avalonia.Rect

The rectangle bounds.

RectangleGeometry Constructor

Initializes a new instance of the Avalonia.Media.RectangleGeometry class.

public RectangleGeometry(Avalonia.Rect rect, double radiusX, double radiusY)
Parameters

rect Avalonia.Rect

The rectangle bounds.

radiusX double

The radius on the X-axis used to round the corners of the rectangle.

radiusY double

The radius on the Y-axis used to round the corners of the rectangle.

Methods

NameDescription
CloneClones the geometry.
CombineCombines the two geometries using the specified Avalonia.Media.GeometryCombineMode and applies the specified transform to the resulting geometry. Inherited from Geometry.
FillContainsIndicates whether the geometry's fill contains the specified point. Inherited from Geometry.
GetRenderBoundsGets the geometry's bounding rectangle with the specified pen. Inherited from Geometry.
GetWidenedGeometryGets a Avalonia.Media.Geometry that is the shape defined by the stroke on the Geometry produced by the specified Pen. Inherited from Geometry.
ParseCreates a Avalonia.Media.Geometry from a string. Inherited from Geometry.
StrokeContainsIndicates whether the geometry's stroke contains the specified point. Inherited from Geometry.
TryGetPointAndTangentAtDistanceInherited from Geometry.
TryGetPointAtDistanceInherited from Geometry.
TryGetSegmentInherited from Geometry.
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

Clone Method

Clones the geometry.

public Avalonia.Media.Geometry Clone()

Returns

Avalonia.Media.Geometry

A cloned geometry.

Properties

NameDescription
RadiusXGets 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.
RadiusYGets 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.
RectGets or sets the bounds of the rectangle.
BoundsGets the geometry's bounding rectangle. Inherited from Geometry.
ContourLengthGets the geometry's total length as if all its contours are placed in a straight line. Inherited from Geometry.
TransformGets or sets a transform to apply to the geometry. Inherited from Geometry.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
ItemInherited from AvaloniaObject.

RadiusX Property

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; }

Remarks

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

RadiusY Property

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; }

Remarks

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

Rect Property

Gets or sets the bounds of the rectangle.

public Avalonia.Rect Rect { get; set; }

Fields

RadiusXProperty Field

Defines the Avalonia.Media.RectangleGeometry.RadiusX property.

public Avalonia.StyledProperty<TValue><double> RadiusXProperty

RadiusYProperty Field

Defines the Avalonia.Media.RectangleGeometry.RadiusY property.

public Avalonia.StyledProperty<TValue><double> RadiusYProperty

RectProperty Field

Defines the Avalonia.Media.RectangleGeometry.Rect property.

public Avalonia.StyledProperty<TValue><Avalonia.Rect> RectProperty

Events

NameDescription
ChangedRaised when the geometry changes. Inherited from Geometry.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.