InlineUIContainer.Child Property

Gets or sets the UIElement hosted by the InlineUIContainer.

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

public UIElement Child { get; set; }
<InlineUIContainer ...>

XAML Values


Exactly one child element that displays within the UI container. This must be a type that derives from UIElement.

Property Value

Type: System.Windows.UIElement
The UIElement hosted by the InlineUIContainer.

An InlineUIContainer may directly host no more than one UIElement child. However, the child element hosted by an InlineUIContainer may host children of its own.

The following code example shows how you can insert an image into a RichTextBox by using the Child property.

//Insert an image into the RichTextBox
private void btnImage_Click(object sender, RoutedEventArgs e)
    InlineUIContainer container = new InlineUIContainer();

    container.Child = MainPage.createImageFromUri(new Uri("/RichNotepad;component/images/Desert.jpg", UriKind.RelativeOrAbsolute), 200, 150);


private static Image createImageFromUri(Uri URI, double width, double height)
    Image img = new Image();
    img.Stretch = Stretch.Uniform;
    img.Width = width;
    img.Height = height;
    BitmapImage bi = new BitmapImage(URI);
    img.Source = bi;
    img.Tag = bi.UriSource.ToString();
    return img;


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

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

Community Additions