Share via


IXRTextBlock::GetText (Compact 2013)

3/28/2014

This method retrieves the text contents of this text block.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetText(
    __out BSTR* pText
) = 0;

Parameters

  • pText
    [out] Pointer to a string that contains the text contents of this text block.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

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 in 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 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.

.NET Framework Equivalent

System.Windows.Controls.TextBlock.Text

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRTextBlock
IXRTextBlock::SetText