Compartilhar via


IXRInlineCollection (Compact 2013)

3/28/2014

This class provides access to a collection of IXRTextElement objects.

Syntax

class IXRInlineCollection : public IXRDependencyObject

Inheritance Hierarchy

IXRDependencyObject

    IXRInlineCollection

Methods

Method

Description

IXRInlineCollection::Add

Adds an item to the end of this collection and retrieves the index of where it was added.

IXRInlineCollection::Clear

Removes all items from this collection.

IXRInlineCollection::Contains

Determines whether an item is in this collection.

IXRInlineCollection::GetCount

Retrieves the number of items in this collection.

IXRInlineCollection::GetItem

Retrieves the item at the specified index in this collection.

IXRInlineCollection::IndexOf

Searches for the specified item and retrieves the zero-based index of its occurrence within this collection.

IXRInlineCollection::Insert

Inserts an item into this collection at the location with the specified index value.

IXRInlineCollection::Remove

Removes a specific item from this collection.

IXRInlineCollection::RemoveAt

Removes the item at the specified index from this collection.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

Remarks

In XAML for Windows Embedded, IXRInlineCollection is used to provide a type for the value of the Inlines property. Inlines are lines of individually formatted text that can exist inside controls such as IXRTextBlock. An IXRInlineCollection object cannot be instantiated directly (in XAML or in C++ code).

To obtain a pointer to this collection, call IXRTextBlock::GetInlines, and then use the methods in this class to add, remove, or retrieve items, including IXRRun and IXRLineBreak objects. You can also clear the complete collection by calling the IXRInlineCollection::Clear method.

When you create a class instance, use an IXRInlineCollectionPtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

To create a new inline collection, use the IXRApplication::CreateObject(IID,Object) method to create an empty IXRInlineCollection object. Then, use CreateObject to create multiple IXRTextElement objects that each define inline text content. Next, add each IXRInline object to the IXRInlineCollection by calling the IXRInlineCollection::Add method. And finally, set the new collection for an IXRTextBlock by calling IXRTextBlock::SetInlines.

In addition to the implicit collection syntax of InlineCollection, the TextBlock XAML element lets you specify content as inner text. Therefore, you can also set content by passing in a string to a call to IXRTextBlock::SetText. For more information, see IXRTextBlock.

XAML Usage

You can also create an inline collection in Microsoft Silverlight 3 XAML. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this collection in the source XAML for your application, see the TextBlock.Inlines Property on MSDN.

You cannot explicitly define an InlineCollection property element in XAML syntax. The XAML parser implicitly accesses an existing IXRInlineCollection that is held by an IXRTextBlock. Then it adds any child elements found in the Inlines property to that existing collection.

In XAML, you include elements that represent one or more objects that derive from IXRInline, such as IXRRun and IXRLineBreak, as child elements of a TextBlock XAML element. The order of the Run and LineBreak XAML elements in the source XAML defines the presentation order in which the elements are rendered in the text block. The order of the IXRInlineCollection items is also significant if you access the collection items using C++ code.

You do not have to specify a TextBlock.Inlines property element in XAML because Inlines is the XAML content property for TextBlock.

.NET Framework Equivalent

System.Windows.Documents.InlineCollection

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Collection Management
IXRTextBlock::SetInlines
IXRTextBlock::GetInlines