This documentation is archived and is not being maintained.

CornerRadius Structure

Represents the radii of a rectangle's corners.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

<TypeConverterAttribute(GetType(CornerRadiusConverter))> _
Public Structure CornerRadius _
	Implements IEquatable(Of CornerRadius)
<CornerRadius .../>
<object property="TopLeft,TopRight,BottomRight,BottomLeft "/>
- or -
<object property="AllCorners"/>

XAML Values


Double value that specifies the radius of the top left corner.


Double value that specifies the top right corner.


Double value that specifies the bottom right corner.


Double value that specifies the bottom left corner.


If only a single Double value is specified, that measure is applied to ALL of the TopLeft, TopRight, BottomRight, and BottomLeft corners of the CornerRadius.


Values need not include the decimal point explicitly when specified as a string. The string "1" provided in XAML evaluates to a value of 1.0 when referenced in code.

The CornerRadius type exposes the following members.

Public methodCornerRadius(Double)Initializes a new instance of the CornerRadius class with a specified uniform radius value for every corner or the rectangle.
Public methodCornerRadius(Double, Double, Double, Double)Initializes a new instance of the CornerRadius class with the specified radius values for each corner of the rectangle.

Public propertyBottomLeftGets or sets the radius of the bottom-left corner.
Public propertyBottomRightGets or sets the radius of the bottom-right corner.
Public propertyTopLeftGets or sets the radius of the top-left corner.
Public propertyTopRightGets or sets the radius of the top-right corner.

Public methodEquals(CornerRadius)Compares two CornerRadius structures for equality.
Public methodEquals(Object)Determines whether the specified Object is a CornerRadius and whether it contains the same corner radius values as this CornerRadius. (Overrides ValueType.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeReturns the hash code for this CornerRadius. (Overrides ValueType.GetHashCode.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns the string representation of the CornerRadius. (Overrides ValueType.ToString.)

Public operatorStatic memberEqualityCompares two CornerRadius structures for equality.
Public operatorStatic memberInequalityCompares two CornerRadius structures for inequality.

This class has four properties, TopLeft, TopRight, BottomLeft, and BottomRight, corresponding to the individual corners of the rectangle. Each is a Double structure that can be set independently of the others.

The radii cannot be negative.

The following example shows how to set the value of the CornerRadius property by using Extensible Application Markup Language (XAML) and code.

Dim myBorder1 As New Border()
myBorder1.BorderBrush = Brushes.SlateBlue
myBorder1.BorderThickness = New Thickness(5, 10, 15, 20)
myBorder1.Background = Brushes.AliceBlue
myBorder1.Padding = New Thickness(5)
myBorder1.CornerRadius = New CornerRadius(15)

<Border BorderBrush="SlateBlue" BorderThickness="5,10,15,20" Background="AliceBlue" Padding="5" CornerRadius="15">

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.