TextBlock


TextBlockHierarchy: UIElement FrameworkElement

 <TextBlock     TextAlignment="Center|End|Justify|Left|Right|Start"     TextWrap="Wrap|NoWrap|Emergency"     TextTrimming="CharacterEllipsis|WordEllipsis|None"     TextEffects="Collection"     TextContent="Lorem ipsum dolar sit amet, consecteteur adipscing elit."     BaselineOffset="10" /> 

or:

 <TextBlock     TextAlignment="Center|End|Justify|Left|Right|Start"     TextWrap="Wrap|NoWrap|Emergency"     TextTrimming="CharacterEllipsis|WordEllipsis|None"     TextEffects="Collection"     BaselineOffset="10">     Lorem ipsum dolar sit amet, consecteteur adipscing elit. </TextBlock> 

<TextBlock .../> displays a block of text. TextBlock is similar to Paragraph in terms of formatting and display, but TextBlock is a UIElement, which means that it can be used outside the context of documents. This element is optimized for UI display.

Attributes


BaselineOffset (optional)

The amount to adjust the baseline offset position. Essentially, this drops the text down the specified distance. This attribute is attached to inline children of TextBlock. The following code fragment raises the baseline of the inline TextBlock so that the text appears above the surrounding text:

 <TextBlock>     This text is normal.     <TextBlock BaselineOffset="20">This text is raised</TextBlock>     This text is normal again. </TextBlock> 


TextAlignment (optional)

Describes how text is aligned horizontally.


Center

Text is center-aligned.


End

Text is aligned on the end of the inline progression, as determined by the current text advance direction.


Justify

Text is justified. This will increase spacing between words if necessary to keep text justified across the width of the TextBox.


Left

In horizontal inline progression, the text is aligned on the left.


Right

In horizontal inline progression, the text is aligned on the right.


Start

The text is aligned on the start of the inline progression, as determined by the current text advance direction.


TextContent (optional)

This attribute contains the text being displayed.


TextEffects (optional)

A collection of TextEffect elements.


TextTrimming (optional)

Determines how to treat text that flows past the end of the element.


CharacterEllipsis

Text is trimmed at a character boundary. Remaining text is replaced with an ellipsis ( . . . ).


None

Text is not trimmed.


WordEllipsis

Text is trimmed at a word boundary. Remaining text is replaced with an ellipsis ( . . . ).


TextWrap (optional)

Determines the behavior of text when it reaches the boundary of its containing box.


Emergency

Text is wrapped even if the line-breaking algorithm cannot determine an optimal wrapping opportunity. This is the default behavior.


NoWrap

Text is not wrapped.


Wrap

Text is wrapped.




XAML in a Nutshell
XAML in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596526733
EAN: 2147483647
Year: 2007
Pages: 217

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net