Udostępnij za pośrednictwem


Control.BorderBrush Property

Definition

Gets or sets a brush that describes the border fill of a control.

public:
 property Brush ^ BorderBrush { Brush ^ get(); void set(Brush ^ value); };
Brush BorderBrush();

void BorderBrush(Brush value);
public Brush BorderBrush { get; set; }
var brush = control.borderBrush;
control.borderBrush = brush;
Public Property BorderBrush As Brush
<control Background="{StaticResource resourceName}"/>
- or -
<control Background="colorString"/>
- or -
<control>
  <control.Background>singleBrush</control.Background>
</control>

Property Value

The brush that is used to fill the control's border. The default is null, (a null brush) which is evaluated as Transparent for rendering.

Remarks

Each control might apply this property differently based on its visual template. This property only affects a control whose template uses the BorderBrush property as an input for the template's UI properties. On other controls, this property has no effect. Typically, if it wants to display a border, a control uses a {TemplateBinding} markup extension to bind its BorderBrush value to the BorderBrush of a Border that is the root element of the control template. For more info about visual templates and control templating, see Styling controls or the reference page for the Template property.

Starting in Windows 10, version 1607 (Windows Software Development Kit (SDK) version 10.0.14393.0), generic.xaml includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. In apps that target this software development kit (SDK) or later, modifying these resources is preferred to setting properties such as Background, Foreground, and BorderBrush. For more info, see the Light-weight styling section of the XAML styles article.

The BorderThickness value must be greater than 0 in order to see the BorderBrush value take effect.

Applies to

See also