Dela via


Border.BorderBrush Property

Definition

Gets or sets the Brush that is applied to the edge area of the Border.

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

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

Property Value

The brush that fills the border. The default is null, (a null brush) which is evaluated as Transparent for rendering.

Examples

This example shows how to set the BorderBrush value to a solid color using an inline-defined attribute value "Blue". The XAML parser uses this "Blue" value to refer to the named color Colors.Blue, and to create the SolidColorBrush instance that supplies the runtime value.

<Border BorderThickness="5" BorderBrush="Blue" >
    <StackPanel Grid.Column="0" Grid.Row="0">
        <TextBlock Text="One"/>
        <TextBlock Text="Two"/>
        <TextBlock Text="Three"/>
    </StackPanel>
</Border>

Remarks

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

Applies to

See also