TextOptions Class
TOC
Collapse the table of content
Expand the table of content

TextOptions Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Provides options for controlling the rendering behavior of text, which can be set through an attached property usage on a wide range of Windows Phone types.

System.Object
  System.Windows.Media.TextOptions

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

public static class TextOptions

The TextOptions type exposes the following members.

  NameDescription
Public attached propertyDisplayColorEmojiGets or sets a value that indicates whether color emoji is displayed.
Public attached propertyTextHintingModeGets or sets a value that indicates whether text rendering is optimized for readability or animation.
Top

  NameDescription
Public methodStatic memberGetDisplayColorEmojiRetrieves the display color of the emoji of the given element.
Public methodStatic memberGetTextHintingModeGets the TextHintingMode for this FrameworkElement.
Public methodStatic memberSetDisplayColorEmojiSets the DisplayColorEmoji property on the given object.
Public methodStatic memberSetTextHintingModeSets the TextHintingMode for this FrameworkElement.
Top

  NameDescription
Public fieldStatic memberDisplayColorEmojiPropertyIdentifies the DisplayColorEmoji dependency property.
Public fieldStatic memberTextHintingModePropertyIdentifies the TextHintingMode attached property.
Top

By default, Windows Phone optimizes text for readability. Although this is usually desirable, the rendering behavior that optimizes readability can have a large performance impact when you animate text. This is because during animation Windows Phone is constantly redrawing the optimized text, and this optimization takes significant resources. When animating text, you will likely get better performance by turning off this readability optimization. To turn off readability optimization on a per-element basis, set the TextOptions.TextHintingMode attached property to Animated and then set it back to Fixed when the animation ends.

When you set TextOptions.TextHintingMode (or call SetTextHintingMode), the value and its associated behavior inherits to all objects that are within the visual tree beneath where the value is set.

Animation that applies to text is not necessarily limited to properties of text elements. The most obvious example of a text property that can benefit from Animated behavior when animated is TextElement.FontSize (or other FontSize properties on specific types). But it might also be beneficial to set Animated behavior whenever any container that contains text animates a property that affects rendering and layout. For example, if you apply a TranslateTransform to a Grid that contains text, that animation may look better if you set TextOptions.TextHintingMode to Animated on that Grid container.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Show:
© 2017 Microsoft