Condividi tramite


Border.CornerRadius Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the radius for the corners of the border.

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

Syntax

'Declaration
Public Property CornerRadius As CornerRadius
public CornerRadius CornerRadius { get; set; }
<Border CornerRadius="uniformRadius"/>
- or -
<Border CornerRadius="topLeft,topRight,bottomRight,bottomLeft"/>

XAML Values

  • If you specify an attribute string with two or three values, only the first value is respected and is treated as the uniformRadius (the other values are ignored). You must specify all four values to use a different behavior than uniformRadius.

  • In the XAML syntaxes shown, you can use a space rather than a comma as the delimiter between values.

Property Value

Type: System.Windows.CornerRadius
The degree to which the corners are rounded.

Remarks

Dependency property identifier field: CornerRadiusProperty

CornerRadius can be a single uniform value for all corners or four unique values. For more information, see CornerRadius.

Examples

The following example shows how to set the corners to be rounded.

<Border Background="Cyan" CornerRadius="20" Grid.Column="2" Grid.Row="2">
    <TextBlock Text="Background Brush" TextWrapping="Wrap" VerticalAlignment="Center" />
</Border>

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.