Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Decorator Content Model Overview

This content model overview describes the supported content for a Decorator. The Border control is a type of Decorator.

This topic contains the following sections.

Decorator Content Property

A Decorator has the following content properties.

The following illustration shows a TextBox decorated with a Border around it.

TextBox with black border

Using the Child Property

The Child property specifies the single UIElement that the Decorator effects (decorates). The following example shows how to use the Child property to add a TextBox to a Border.

<Page xmlns=""
    <Border BorderThickness="20" BorderBrush="Black">
      <TextBox>TextBox with a black Border around it</TextBox>

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace SDKSample
    public partial class BasicBorderExample : Page
        public BasicBorderExample()

            TextBox myTextBox = new TextBox();

            // Put some initial text in the TextBox.
            myTextBox.Text = "TextBox with a black Border around it";

            // Create a Border
            Border myBorder = new Border();
            myBorder.BorderThickness = new Thickness(20);
            myBorder.BorderBrush = Brushes.Black;

            // Add TextBox to the Border.
            myBorder.Child = myTextBox;
            // myStackPanel.Children.Add(myTextBox);
            this.Content = myBorder; 

Types That Share This Content Model

Types That Can Contain Decorator Objects

See Also

© 2018 Microsoft