Windows.UI.Xaml.Shapes.Rectangle

June 22, 2022 · View on GitHub

-description

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

-xaml-syntax

<Rectangle .../>

-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.

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

-see-also

Shape, XAML vector-based drawing sample, Draw shapes