Text Wrapping
Last updated
Was this helpful?
Last updated
Was this helpful?
TextRuntime
automatically wraps text according to its Width
values. By default, text wrapping is effectively disabled for new TextRuntime
instances, but it may be enabled if the TextRuntime is already a part of another control, such as a Button
.
Text wrapping is determined based on the Text
property and the size that is given to render the text based on the TextRuntime's Width
and WidthUnits
.
Text wrapping will not occur if the TextRuntime
's WidthUnits
are set to RelativeToChildren
since the instance automatically resizes itself to fit all letters. Otherwise, text wrapping may occur if the Text
value is long enough.
For a more detailed discussion of WidthUnits see the .
The following code creates a Text instance which wraps its text. Since its Width
is set to 100 absolute, the wrapped text must fit inside the TextRuntime
's absolute width.
TextRuntime treats its internal letters as children. If WidthUnits is changed to RelativeToChildren then the text no longer wraps since the TextRuntime sizes itself to contain all letters horizontally as shown in the following code block: