Compartilhar via


IXRTextBlock::GetInlines (Compact 2013)

3/28/2014

This method retrieves the collection of inline text elements within this text block.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetInlines(
    IXRInlineCollection** ppInlines
) = 0;

Parameters

  • ppInlines
    [out] Address of a pointer to an IXRInlineCollection that holds all inline text elements within this text block.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

You can remove items from the existing collection by using the IXRInlineCollection::Remove or IXRInlineCollection::RemoveAt methods of IXRInlineCollection.

You can access items in the existing collection by using the IXRInlineCollection::GetItem method. You can clear the complete collection by using the IXRInlineCollection::Clear method.

The IXRTextBlock object is the primary text element for displaying text in XAML for Windows Embedded-based applications.

A text block can be thought of as having two object models, as follows:

  • A representation as a Text property, which represents only string content. The text has no formatting other than the formatting that is declared by using the methods on the IXRTextBlock class.
  • A representation as an IXRInlineCollection. The collection contains primarily IXRRun objects, each of which can declare its own formatting properties such as FontSize by using the methods that it inherits from IXRTextElement. The Text property returns a value. This value is the appended text of all IXRRun objects in the IXRInlineCollection. However, the returned value does not include any formatting that was applied to the IXRRun objects. If the inline collection is created from XAML as the inner text of an IXRTextBlock object, or if it is created by calling IXRTextBlock::SetText, the IXRInlineCollection contains a single IXRRun that contains the text.

You can work with either object model. However, if the text consists of series of text elements that have individual formatting in an IXRInlineCollection, and if you modify the text by appending to the Text value, you will flatten the previous IXRInlineCollection content and replace it with a single, unformatted IXRRun with the new text.

To access text in this text block as string content, use IXRTextBlock::GetText and IXRTextBlock::SetText. To access text in this text block as an inline collection, use GetInlines and IXRTextBlock::SetInlines.

An IXRTextBlock can contain a mix of inner text and inline elements. In this case, each inner text section is parsed and converted into an IXRRun object in the object tree, instead of being preserved as true inner text of the IXRTextBlock. Because of this behavior, you can freely mix inner text and inline elements. Multiple blocks of inner text can be mixed with multiple inline elements.

The IXRInlineCollection in ppInline is created implicitly by parsing the IXRTextBlock content defined in the source XAML. For more information about how to define this collection in XAML, see the Microsoft Silverlight 3 documentation.

.NET Framework Equivalent

System.Windows.Controls.TextBlock.Inlines

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRTextBlock
IXRTextBlock::SetInlines