Dela via


Control.CornerRadius Property

Definition

Gets or sets the radius for the corners of the control's border.

public:
 property CornerRadius CornerRadius { CornerRadius get(); void set(CornerRadius value); };
CornerRadius CornerRadius();

void CornerRadius(CornerRadius value);
public CornerRadius CornerRadius { get; set; }
var cornerRadius = control.cornerRadius;
control.cornerRadius = cornerRadius;
Public Property CornerRadius As CornerRadius
<control CornerRadius="uniformRadius"/>
- or -
<control CornerRadius="topLeft,topRight,bottomRight,bottomLeft"/>

Property Value

The degree to which the corners are rounded, expressed as values of the CornerRadius structure.

Windows requirements

Device family
Windows 10, version 1809 (introduced in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v7.0)

Examples

<Button Content="Button" 
        Background="Blue"
        BorderThickness="1.0"
        BorderBrush="Black"
        CornerRadius="15" />

Remarks

Member components of a CornerRadius value cannot be negative.

CornerRadius property on Control behaves the same way Border.CornerRadius does. CornerRadius is a rendering artifact and does not impact layout of the contents (clipping may occur).

The default CornerRadius value in all control templates is 0. Setting the CornerRadius property impacts those controls that have a Border in their ControlTemplate (Example: Button, ComboBox).

Applies to

See also