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
<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()

Initializes a new instance of the Rectangle class.

public : Rectangle()public Rectangle()Public Sub New()
Attributes

Properties

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
<Rectangle RadiusX="double"/>
Value
double double double

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

Attributes

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the RadiusX dependency property.

Attributes

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
<Rectangle RadiusY="double"/>
Value
double double double

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

Attributes

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the RadiusY dependency property.

Attributes

See Also