RadiusX Property
Collapse the table of content
Expand the table of content

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)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

property double RadiusX {
	double get ();
	void set (double value);
<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, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

© 2016 Microsoft