📜 ⬆️ ⬇️

WPF 4.0 - Text Display

Perhaps for many this topic will not be a revelation, but I personally found out about it quite recently. However, for many novice developers, it can be useful.

As you know, since birth WPF has had problems with displaying text. This was especially noticeable on non-large fonts (labels for buttons, Labels, ListBoxes, etc.) However, with the release of version 4.0, Microsoft seriously reworked the text output and added some useful attached properties.

I will not dwell in detail on the consideration of all the properties, but I will give only a short recipe on how to make your controls in WPF form appear with clear text. I emphasize that it is applicable to the situation when you use standard controls without any special transformations, animations and huge text.
')
So, it is enough to add the following properties to the element of your window:

<Window TextOptions.TextFormattingMode="Display" ...... />


The result can be seen here (by clicking the full image):



Approximately, because the screenshot does not completely reflect the difference, everything is much better on the running application.

For those who want to read more about rendering text in WPF 4.0 there is a wonderful blog dedicated exclusively to this topic: WPF Text Blog . I highly recommend reading this post: blogs.msdn.com/b/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx

UPD: A colleague advised an interesting post topic of text rendering: www.codinghorror.com/blog/2007/06/font-rendering-respecting-the-pixel-grid.html

Source: https://habr.com/ru/post/109313/


All Articles