Control.BorderBrush Property

Definition

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

C#
[System.ComponentModel.Bindable(true)]
public System.Windows.Media.Brush BorderBrush { get; set; }

Property Value

The brush that is used to fill the control's border; the default is Transparent.

Attributes

Examples

The following example shows how to set the border brush property of a control.

XAML
<Button Name="btn6" BorderBrush="Red" 
        Click="ChangeBorderBrush">
  BorderBrush
</Button>
C#
void ChangeBorderBrush(object sender, RoutedEventArgs e)
{
    if (btn6.BorderBrush == Brushes.Red)
    {
        btn6.BorderBrush = Brushes.Black;
        btn6.Content = "Control border brush changes from red to black.";
    }
    else
    {
        btn6.BorderBrush = Brushes.Red;
        btn6.Content = "BorderBrush";
        }
}

Remarks

This property only affects a control whose template uses the BorderBrush property as a parameter. On other controls, this property has no impact.

Dependency Property Information

Item Value
Identifier field BorderBrushProperty
Metadata properties set to true AffectsRender, SubPropertiesDoNotAffectRender

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9