O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required