Share via


IXRTextBlock::SetInlines (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

virtual HRESULT STDMETHODCALLTYPE SetInlines(
    IXRInlineCollection* pInlines
) = 0;

Parameters

  • pInline
    [in] Pointer to an IXRInlineCollection that holds all new inline text elements within this text block.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

You can create new IXRInline objects for this collection by calling IXRApplication::CreateObject(IID,Object). Then, you can add objects to this collection by calling the inherited IXRCollection<In_T, Out_T>::Add or IXRCollection<In_T, Out_T>::Insert methods.

The IXRTextBlock object is the primary text element for displaying text in Silverlight–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 IXRInline. 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 a 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 IXRTextBlock::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.

.NET Framework Equivalent

System.Windows.Controls.TextBlock.Inlines

Requirements

sysgen SYSGEN_XAML_RUNTIME
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

IXRTextBlock
IXRTextBlock::GetInlines