Rectangle

Rectangle doesn’t define a special Size or Bounds property; it leverages the familiar XAML layout system for controlling its size and position. For example, you could set the size of a Rectangle with its Width and Height properties (among others) inherited from FrameworkElement, and set its location using Canvas.Left and Canvas.Top if it’s inside a Canvas.

Rectangle, however, defines its own RadiusX and RadiusY properties of type double that enable you to give it rounded corners. Figure 7.1 shows the following Rectangles in a StackPanel with various values of RadiusX and RadiusY:

<StackPanel>  <Rectangle Width="200" Height="100"    Fill="Orange" Stroke="Black" StrokeThickness="10" Margin="4"/>  <Rectangle ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.