Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 3.27 KB

inlineuicontainer.md

File metadata and controls

63 lines (41 loc) · 3.27 KB
-api-id -api-type
T:Windows.UI.Xaml.Documents.InlineUIContainer
winrt class

Windows.UI.Xaml.Documents.InlineUIContainer

-description

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

-xaml-syntax

<InlineUIContainer .../>
-or-
<InlineUIContainer ...>
  singleChild
</InlineUIContainer>

-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 TextBlock.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>

-see-also

Inline, RichTextBlock, UIElement