Border.BorderBrush property

Applies to Windows and Windows Phone

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

Syntax


public Brush BorderBrush { get; set; }


<Border BorderBrush="{StaticResource resourceName}"/>



<Border BorderBrush="colorString"/>



<Border>
  <Border.BorderBrush>singleBrush</Border.BorderBrush>
</Border>


XAML Values

resourceName

The resource name (x:Key value) of an existing XAML resource that defines a brush. This is the recommended way to specify Brush values in XAML if you have any intention of using the same colors or brushes in more than one part of your UI. See Remarks in Brush or ResourceDictionary and XAML resource references.

colorString

The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. See the "XAML Values" section in Color.

singleBrush

Within opening and closing property elements, exactly one object element for an object that derives from Brush. This is typically one of the following classes: LinearGradientBrush, ImageBrush, SolidColorBrush.

Property value

Type: Brush

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

Remarks

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

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>


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

Border
Quickstart: Using brushes

 

 

Show:
© 2014 Microsoft