Condividi tramite


Border.Child Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property Child As UIElement
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.

Remarks

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.

Examples

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>

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.