Border.Child Property

July 28, 2014

Gets or sets the child element to draw the border around.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public UIElement Child { get; set; }
<Border>
  singleChild
</Border>

XAML Values

singleChild

A single object element that the border encloses. This child must be an object that derives from UIElement.

Property Value

Type: System.Windows.UIElement
The UIElement to apply the border to.

Border can have only one child object. To apply a border around multiple objects, wrap the elements in a container (StackPanel, Grid, or Canvas, for example) and put the border around the container.

Child is the XAML content property for Border. A content item for a Border sets the Child property; a Border.Child property element is not required to enclose the content.

The following example shows how to wrap a border around multiple objects using a StackPanel as the container.


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


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft