Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Animating Text in Silverlight

Text animations in Silverlight have been really dissapointing in the past.  Especially with zooming, text motion looked extremely choppy.  However Silverlight 3 includes a text rendering option that significantly improves text rendering - TextHintingMode

Setting the TextHintingMode to Animated allows you to achieve this effect.  The default TextHintingMode is set to Fixed, which is intended to improve overall readability.  To me, Animated looks like a graphic, while Fixed looks like HTML.  Since I’m usually trying to make Silverlight text look clean as opposed to easily readable, the Animated text rendering looks better to me in general.  Plus I can’t find any drawbacks to using it, so I see myself using it more often than not, even if the text isn’t going to be animated.

To set TextHintingMode, you must use the SetTextHintingMode function in Silverlight’s static TextOptions class.  http://msdn.microsoft.com/en-us/library/system.windows.media.textoptions(VS.95).aspx

For example - If my TextBlock is named textBlock, the following would suffice:

TextOptions.SetTextHintingMode(textBlock, TextHintingMode.Animated);

No Comments