CornerRadius CornerRadius CornerRadius CornerRadius Struct

Definition

Represents the radii of a rectangle's corners.

public value class CornerRadius : IEquatable<System::Windows::CornerRadius>
[System.ComponentModel.TypeConverter(typeof(System.Windows.CornerRadiusConverter))]
public struct CornerRadius : IEquatable<System.Windows.CornerRadius>
type CornerRadius = struct
Public Structure CornerRadius
Implements IEquatable(Of CornerRadius)
Inheritance
CornerRadiusCornerRadiusCornerRadiusCornerRadius
Attributes
Implements

Examples

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

myBorder1 = 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);
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">

Remarks

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.

XAML Attribute Usage

<object property="TopLeft,TopRight,BottomRight,BottomLeft "/>  
- or -  
<object property="AllCorners"/>  

XAML Values

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

TopRight
Double value that specifies the top right corner.

BottomRight
Double value that specifies the bottom right corner.

BottomLeft
Double value that specifies the bottom left corner.

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

Note

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.

Constructors

CornerRadius(Double) CornerRadius(Double) CornerRadius(Double) CornerRadius(Double)

Initializes a new instance of the CornerRadius class with a specified uniform radius value for every corner or the rectangle.

CornerRadius(Double, Double, Double, Double) CornerRadius(Double, Double, Double, Double) CornerRadius(Double, Double, Double, Double) CornerRadius(Double, Double, Double, Double)

Initializes a new instance of the CornerRadius class with the specified radius values for each corner of the rectangle.

Properties

BottomLeft BottomLeft BottomLeft BottomLeft

Gets or sets the radius of the bottom-left corner.

BottomRight BottomRight BottomRight BottomRight

Gets or sets the radius of the bottom-right corner.

TopLeft TopLeft TopLeft TopLeft

Gets or sets the radius of the top-left corner.

TopRight TopRight TopRight TopRight

Gets or sets the radius of the top-right corner.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified Object is a CornerRadius and whether it contains the same corner radius values as this CornerRadius.

Equals(CornerRadius) Equals(CornerRadius) Equals(CornerRadius) Equals(CornerRadius)

Compares two CornerRadius structures for equality.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Returns the hash code for this CornerRadius.

ToString() ToString() ToString() ToString()

Returns the string representation of the CornerRadius.

Operators

Equality(CornerRadius, CornerRadius) Equality(CornerRadius, CornerRadius) Equality(CornerRadius, CornerRadius) Equality(CornerRadius, CornerRadius)

Compares two CornerRadius structures for equality.

Inequality(CornerRadius, CornerRadius) Inequality(CornerRadius, CornerRadius) Inequality(CornerRadius, CornerRadius) Inequality(CornerRadius, CornerRadius)

Compares two CornerRadius structures for inequality.

Applies to

See Also