IXRTextBlock::GetInlines (Windows Embedded CE 6.0)
1/6/2010
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 inherited IXRCollection<In_T, Out_T>::Remove or IXRCollection<In_T, Out_T>::RemoveAt methods of IXRInlineCollection.
You can access items in the existing collection by using the inherited IXRCollection<In_T, Out_T>::GetItem method. You can clear the complete collection by using the inherited IXRCollection<In_T, Out_T>::Clear method.
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 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 2 documentation.
.NET Framework Equivalent
System.Windows.Controls.TextBlock.Inlines
Requirements
sysgen | SYSGEN_XAML_RUNTIME |
Windows Embedded CE | Windows Embedded CE 6.0 R3 |