Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.8 KB

File metadata and controls

45 lines (31 loc) · 1.8 KB
-api-id -api-type
T:Microsoft.UI.Xaml.Shapes.Rectangle
winrt class

Microsoft.UI.Xaml.Shapes.Rectangle

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

Tip

For more info, design guidance, and code examples, see Draw shapes.

[!div class="nextstepaction"] Open the WinUI 3 Gallery app and see Shape features in action.

The WinUI 3 Gallery app includes interactive examples of most WinUI 3 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub

-see-also

Shape, XAML vector-based drawing sample, Draw shapes