The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

RectangleGeometry.RadiusX Property

Gets or sets the x-radius of the ellipse use to round the corners of the rectangle.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

public double RadiusX { get; set; }
<object RadiusX="double" .../>

Property Value

Type: System.Double
A value greater than or equal to zero and less than or equal to half the rectangle's width that describes the x-radius of the ellipse use to round the corners of the rectangle. Values greater than half the rectangle's width are treated as though equal to half the rectangle's width. Negative values are treated as positive values. The default is 0.0.

Identifier field


Metadata properties set to true


For the rectangle to have rounded corners, both the RadiusX and RadiusY properties must be non-zero.

To round the corners of a RectangleGeometry, set its RadiusX and RadiusY properties to a value greater than zero. The larger the values, the rounder the rectangle's corners.

The following example shows several RectangleGeometry objects with different RadiusX and RadiusY settings. The RectangleGeometry objects are displayed using Path elements.



    <!-- Create a grid background to highlight the
         coordinate system. -->
    <DrawingBrush x:Key="GridDrawingBrushResource" 
      ViewportUnits="Absolute" TileMode="Tile">
            <GeometryDrawing Brush="White">
                <RectangleGeometry Rect="0,0,1,1" />
            <GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z" Brush="#CCCCFF" />
            <GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="#CCCCFF" />

    <!-- Create a graph paper style border to frame the rectangles. -->
    <Style x:Key="GraphPaperBorderStyle" TargetType="{x:Type Border}">
      <Setter Property="HorizontalAlignment" Value="Left" />
      <Setter Property="Background" 
        Value="{StaticResource GridDrawingBrushResource}" />
      <Setter Property="BorderBrush" Value="Black" />
      <Setter Property="BorderThickness" Value="1" />
      <Setter Property="Margin" Value="10" />
      <Setter Property="Width" Value="190" />
      <Setter Property="Height" Value="90" />

  <StackPanel Name="MainStackPanel">

    <Border Style="{StaticResource GraphPaperBorderStyle}">
      <Path Stroke="Black" 

          <!-- Create a rectangle without rounded corners.  -->
            Rect="20,20,150,50"  />

    <Border Style="{StaticResource GraphPaperBorderStyle}">
      <Path Stroke="Black" 

          <!-- Create a rectangle with rounded corners
             by giving the RectangleGeometry a RadiusX
             and a RadiusY of 10.  -->
            Rect="20,20,150,50" RadiusX="10" RadiusY="10" />

    <Border Style="{StaticResource GraphPaperBorderStyle}" >
      <Path Stroke="Black" 

          <!-- Set RadiusX and RadiusY to their maximum values 
             (half the rectangle's width and 
              half the rectangle's height).  -->
            Rect="20,20,150,50" RadiusX="75" RadiusY="25"  />

Rectangles with Rounded Corners

Rectangles with different RadiusX/RadiusY settings

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft