Rectangle Rectangle Rectangle Rectangle Class

Definition

Draws a rectangle with a given Height and Width specified in device-independent pixel (DIP).

public : sealed class Rectangle : Shape, IRectanglepublic sealed class Rectangle : Shape, IRectanglePublic NotInheritable Class Rectangle Inherits Shape Implements IRectangle// This API is not available in Javascript.
<Rectangle .../>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Examples

This example shows how to create a Rectangle in XAML and set some of its common properties as attribute values.

<Canvas>  
  <Rectangle Width="100" Height="100" Fill="Blue" Stroke="Red" 
   Canvas.Top="20" Canvas.Left="20" StrokeThickness="3" />
</Canvas>

Remarks

You can set the Fill property to give the shape a background fill, like a solid color, gradient, or image. You can set the Stroke and other related stroke properties to specify the look of the shape's outline.

Constructors

Rectangle() Rectangle() Rectangle() Rectangle()

Initializes a new instance of the Rectangle class.

public : Rectangle()public Rectangle()Public Sub New()// This API is not available in Javascript.

Properties

RadiusX RadiusX RadiusX RadiusX

Gets or sets the x-axis radius of the ellipse that is used to round the corners of the rectangle.

public : double RadiusX { get; set; }public double RadiusX { get; set; }Public ReadWrite Property RadiusX As double// This API is not available in Javascript.
<Rectangle RadiusX="double"/>
Value
double double double double

The x-axis radius of the ellipse that is used to round the corners of the rectangle.

RadiusXProperty RadiusXProperty RadiusXProperty RadiusXProperty

Identifies the RadiusX dependency property.

public : static DependencyProperty RadiusXProperty { get; }public static DependencyProperty RadiusXProperty { get; }Public Static ReadOnly Property RadiusXProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the RadiusX dependency property.

RadiusY RadiusY RadiusY RadiusY

Gets or sets the y-axis radius of the ellipse that is used to round the corners of the rectangle.

public : double RadiusY { get; set; }public double RadiusY { get; set; }Public ReadWrite Property RadiusY As double// This API is not available in Javascript.
<Rectangle RadiusY="double"/>
Value
double double double double

The y-axis radius of the ellipse that is used to round the corners of the rectangle. The default is 0.

RadiusYProperty RadiusYProperty RadiusYProperty RadiusYProperty

Identifies the RadiusY dependency property.

public : static DependencyProperty RadiusYProperty { get; }public static DependencyProperty RadiusYProperty { get; }Public Static ReadOnly Property RadiusYProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the RadiusY dependency property.

See Also