InlineUIContainer InlineUIContainer InlineUIContainer Class

Provides an inline content element that enables UIElement types to be embedded in the content of a RichTextBlock.

Syntax

Declaration

public sealed class InlineUIContainerpublic sealed class InlineUIContainerPublic NotInheritable Class InlineUIContainer
<InlineUIContainer .../>
-or-
<InlineUIContainer ...>
  singleChild
</InlineUIContainer>

Inheritance Hierarchy

Inherited Members

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Remarks

The most common scenario for using an InlineUIContainer object is to introduce an image into text content. Use a new Image object for the image, as the child content for an InlineUIContainer. Set Height and Width on the image if you don't want it to scale to the natural image size.

If you want more than one element inlined in the same position, consider using a panel as the single InlineUIContainer child and then placing the multiple elements within that panel.

If placed within an InlineUIContainer, a control that can be focused still appears in the top-level tab sequence.

If you want interactive text, consider using a Hyperlink element (a type of Inline ) rather than using InlineUIContainer with a Button or similar within it. See Guidelines for links.

InlineUIContainer inherits properties from the TextElement class. However, most of these properties don't have any visible effect. It's most common to declare a InlineUIContainer object element in XAML without there being any attributes set (except possibly x:Name attribute) with the single child element that you're inlining as content of the InlineUIContainer object element.

Setting properties on InlineUIContainer that otherwise affect the character line height of a text element (such as FontSize, FontFamily ) has no effect on the rendering and appearance. The content dictates its size and the InlineUIContainer sizes to fit it.

If there's further text within the child content (like Text or other text elements within a nested RichTextBlock ) the text element properties of the InlineUIContainer parent won't inherit into the content, they're ignored.

Examples

The following code example shows how you can insert an image into a RichTextBlock by using InlineUIContainer.

<RichTextBlock>
    <Paragraph>
        <Italic>This is an inline image.</Italic>

        <InlineUIContainer>
            <Image Source="Assets/SmallLogo.png" Height="30" Width="30"/>
        </InlineUIContainer>

        Mauris auctor tincidunt auctor.
    </Paragraph>
</RichTextBlock>

Constructors summary

Initializes a new instance of the InlineUIContainer class.

Properties summary

Gets or sets the UIElement hosted by the InlineUIContainer.

Constructors

  • InlineUIContainer()
    InlineUIContainer()
    InlineUIContainer()
    InlineUIContainer()

    Initializes a new instance of the InlineUIContainer class.

    public InlineUIContainer()public InlineUIContainer()Public Function InlineUIContainer() As

Properties

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.UI.Xaml.Markup.ContentPropertyAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute

Details

Assembly

Windows.UI.Xaml.Documents.dll