CornerRadius CornerRadius CornerRadius CornerRadius Struct

Definition

Describes the characteristics of a rounded corner, such as can be applied to a Border.

public : struct CornerRadiuspublic struct CornerRadiusPublic Structure CornerRadius// This API is not available in Javascript.
<CornerRadius>uniformRadius</CornerRadius>
-or-
<CornerRadius>topLeft,topRight,bottomRight,bottomLeft</CornerRadius>
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

This XAML example shows several styles of Border using different CornerRadius values:

    <StackPanel>
        <Border Height="30" Width="200" CornerRadius="0" 
         BorderThickness="2" BorderBrush="Red" Margin="5">
            <TextBlock>CornerRadius: 0</TextBlock>
        </Border>
        <Border Height="30" Width="200" CornerRadius="5" 
         BorderThickness="2" BorderBrush="Red" Margin="5">
            <TextBlock>CornerRadius: 5</TextBlock>
        </Border>
        <Border Height="30" Width="200" CornerRadius="5,0,5,0" 
         BorderThickness="2" BorderBrush="Red" Margin="5">
            <TextBlock>CornerRadius: 5,0,5,0</TextBlock>
        </Border>
        <Border Height="30" Width="200" CornerRadius="5,5,0,0" 
         BorderThickness="2" BorderBrush="Red" Margin="5">
            <TextBlock>CornerRadius: 5,5,0,0</TextBlock>
        </Border>
    </StackPanel>

The XAML produces this rendered output:

rendered output of CornerRadius XAML example

Remarks

Notes on XAML syntax

Although you can specify a CornerRadius as an object element, you cannot specify the individual values such as BottomLeft as attributes of that object element. The XAML parser does not support setting XAML attribute values for this structure. Instead, you must specify the values as initialization text within the CornerRadius. Using the object element syntax for a CornerRadius is useful if you want to declare a keyed resource that can be used by multiple Border instances for their Border.CornerRadius. For more info on XAML initialization text, see XAML syntax guide.

If you specify an attribute string or initialization text 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.

You can use a space rather than a comma as the delimiter between values.

Projection and members of CornerRadius

If you are using a Microsoft .NET language (C# or Microsoft Visual Basic), or in Visual C++ component extensions (C++/CX), then CornerRadius has non-data members available, and its data members are exposed as read-write properties, not fields.

If you are programming with C++ using the Windows Runtime Template Library (WRL), then only the data member fields exist as members of CornerRadius, and you cannot use the utility methods or properties listed in the members table. WRL code can access similar utility methods that exist on the CornerRadiusHelper class.

Fields

BottomLeft BottomLeft BottomLeft BottomLeft

The radius of rounding, in pixels, of the lower-left corner of the object where a CornerRadius is applied.

public : field double BottomLeftpublic field double BottomLeftPublic Field BottomLeft// This API is not available in Javascript.

BottomRight BottomRight BottomRight BottomRight

The radius of rounding, in pixels, of the lower-right corner of the object where a CornerRadius is applied.

public : field double BottomRightpublic field double BottomRightPublic Field BottomRight// This API is not available in Javascript.

TopLeft TopLeft TopLeft TopLeft

The radius of rounding, in pixels, of the upper-left corner of the object where a CornerRadius is applied.

public : field double TopLeftpublic field double TopLeftPublic Field TopLeft// This API is not available in Javascript.

TopRight TopRight TopRight TopRight

The radius of rounding, in pixels, of the upper-right corner of the object where a CornerRadius is applied.

public : field double TopRightpublic field double TopRightPublic Field TopRight// This API is not available in Javascript.