The RadiusX and RadiusY properties of the Rectangle class are used to set the roundness of a rectanble. The following code creaetes a rounded rectangle.

/// <summary>

/// Creates a rounded blue rectangle with black border

/// </summary>

public void CreateARoundedRectangle()

{

// Create a Rectangle

Rectangle blueRectangle = new Rectangle();

blueRectangle.Height = 100;

blueRectangle.Width = 200;

// Create a blue and a black Brush

SolidColorBrush blueBrush = new SolidColorBrush();

blueBrush.Color = Colors.Blue;

SolidColorBrush blackBrush = new SolidColorBrush();

blackBrush.Color = Colors.Black;

// Set Rectangle's width and color

blueRectangle.StrokeThickness = 4;

blueRectangle.Stroke = blackBrush;

// Fill rectangle with blue color

blueRectangle.Fill = blueBrush;

// Set roundness

blueRectangle.RadiusX = 20;

blueRectangle.RadiusY = 20;

// Add Rectangle to the Grid.

LayoutRoot.Children.Add(blueRectangle);

}