IXRRun::SetText (Windows Embedded CE 6.0)
1/6/2010
This method sets the text contents of this run of text.
Syntax
virtual HRESULT STDMETHODCALLTYPE SetText(
const WCHAR* pText
) = 0;
Parameters
- pText
[in] Pointer to a string that contains the text contents of this run of text.
Return Value
Returns an HRESULT that indicates success or failure.
Remarks
The IXRTextBlock object is the primary element for displaying text in a Silverlight application. Used most simply, an IXRTextBlock object shows the contents of the text that you set by calling IXRTextBlock::SetText, which is formatted by using the formatting methods in the IXRTextBlock class.
Alternatively, an IXRTextBlock object can show multiple segments of formatted text each defined in its IXRInlineCollection collection. This collection contains IXRRun objects, each of which you can declare custom formatting properties for by using inherited methods such as IXRInline::SetFontSize. When you set text by using IXRRun objects, IXRTextBlock::GetText still returns a value, which is the appended text of all IXRRun objects in the IXRInlineCollection collection. However, it does not capture any formatting that is applied to those IXRRun objects. If created from Microsoft Silverlight 2 XAML as inner text of a <TextBlock> or if created by calling IXRTextBlock::SetText, the IXRInlineCollection object contains a single IXRRun object that contains that text.
You can decide to work with either object model. However, be aware that text formatting will be lost from a series of text elements that have individual formatting from an IXRInlineCollection object if you adjust the text by first calling IXRTextBlock::GetText, appending it to the retrieved string value, and then calling IXRTextBlock::SetText. The initial IXRInlineCollection collection content will be flattened and replaced with a single new unformatted IXRRun that has your new text. This behavior is generally undesirable.
For more information about how to set the text of a run element in Silverlight 2 XAML, see this Microsoft Web site.
.NET Framework Equivalent
System.Windows.Documents.Run.Text
Requirements
sysgen | SYSGEN_XAML_RUNTIME |
Windows Embedded CE | Windows Embedded CE 6.0 R3 |