InlineUIContainer class

Applies to Windows and Windows Phone

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

Inheritance

Object
  DependencyObject
    TextElement
      Inline
        InlineUIContainer

Syntax

Public NotInheritable Class InlineUIContainer
    Inherits Inline

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


XAML Values

singleChild

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

Attributes

[ContentProperty("Name=Child")]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The InlineUIContainer class has these types of members:

Constructors

The InlineUIContainer class has these constructors.

ConstructorDescription
InlineUIContainer Initializes a new instance of the InlineUIContainer class.

 

Methods

The InlineUIContainer class has these methods. It also inherits methods from the Object class.

MethodDescription
ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject)
FindName Retrieves an object in the object model / runtime object graph by referencing the object's x:Name or Name attribute value. (Inherited from TextElement)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)
OnDisconnectVisualChildren Override this method to implement how layout and logic should behave when items are removed from a class-specific content or child property. (Inherited from TextElement)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject)
SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)

 

Properties

The InlineUIContainer class has these properties.

PropertyAccess typeDescription

CharacterSpacing

Read/writeGets or sets the uniform spacing between characters, in units of 1/1000 of an em. (Inherited from TextElement)

Child

Read/writeGets or sets the UIElement hosted by the InlineUIContainer.

ContentEnd

Read-onlyGets a TextPointer that represents the end of the content in the element. (Inherited from TextElement)

ContentStart

Read-onlyGets a TextPointer that represents the start of content in the element. (Inherited from TextElement)

Dispatcher

Read-onlyGets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)

ElementEnd

Read-onlyGets a TextPointer that represents the position just after the end of the element. (Inherited from TextElement)

ElementStart

Read-onlyGets a TextPointer that represents the position just before the start of the element. (Inherited from TextElement)

FontFamily

Read/writeGets or sets the preferred top-level font family for the content of the element. (Inherited from TextElement)

FontSize

Read/writeGets or sets the font size for the content of the element. (Inherited from TextElement)

FontStretch

Read/writeGets or sets the glyph width of the font in a family to select. (Inherited from TextElement)

FontStyle

Read/writeGets or sets the font style for the content in this element. (Inherited from TextElement)

FontWeight

Read/writeGets or sets the top-level font weight to select from the font family for the content in this element. (Inherited from TextElement)

Foreground

Read/writeGets or sets the Brush to apply to the content in this element. (Inherited from TextElement)

IsTextScaleFactorEnabled

Read/writeGets or sets whether automatic text enlargement, to reflect the system text size setting, is enabled. (Inherited from TextElement)

Language

Read/writeGets or sets localization/globalization language information that applies to a TextElement. (Inherited from TextElement)

Name

Read-onlyGets or sets a unique identification for the object. Name can only be set from initial parsing of XAML. (Inherited from TextElement)

 

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) 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>

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Documents
Windows::UI::Xaml::Documents [C++]

Metadata

Windows.winmd

See also

Inline
RichTextBlock
UIElement

 

 

Show:
© 2014 Microsoft