Child Property
Collapse the table of content
Expand the table of content

InlineUIContainer.Child Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the UIElement hosted by the InlineUIContainer.

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

'Declaration
Public Property Child As UIElement
<InlineUIContainer ...>
  singleChild
</InlineUIContainer>

XAML Values

singleChild

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 Sub btnImage_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim container As InlineUIContainer = New InlineUIContainer
    container.Child = MainPage.createImageFromUri(New Uri("/RichNotepad;component/images/Desert.jpg", UriKind.RelativeOrAbsolute), 200, 150)
    rtb.Selection.Insert(container)
    'ReturnFocus()
End Sub

Private Shared Function createImageFromUri(ByVal URI As Uri, ByVal width As Double, ByVal height As Double) As Image
    Dim img As Image = New Image
    img.Stretch = Stretch.Uniform
    img.Width = width
    img.Height = height
    Dim bi As BitmapImage = New BitmapImage(URI)
    img.Source = bi
    img.Tag = bi.UriSource.ToString
    Return img
End Function


Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2017 Microsoft