2

I need to add white outline to the fonts of TextBlock to ensure text is visible on any background color.

I've read plenty of tutorials, but couldn't make it work. A lot of materials is outdated and doesn't compile on Windows 10.

Do you have any ideas how can I add outline to text in TextBlock?

michalsol
  • 752
  • 8
  • 29
  • Having no idea how to do it, 'd say you need a specific font for that. Regardless of that, why don't you follow the MSFT design patterns and use the colors provided by the application theme? (assuring yourself that it will work on balck and white themes everytime) – Nahuel Ianni May 26 '16 at 14:22
  • Is the text static, or dynamic? If it's static you could just convert it to Path's and apply stroke. As UWP is more silverlight based there is no way to just do it out of the box, though you could provide the illusion of the effect in the same manner shown [here](http://stackoverflow.com/questions/17835250/apply-stroke-to-textblock-in-xaml). However @NahuelIanni has a good point in that following the general design guidelines you shouldn't run into the issue of lacking contrast like you describe. – Chris W. May 26 '16 at 14:45
  • @ChrisW. Unfortunately, text is dynamic. I would like to show this text on image (which can have various colours), I would prefer not to use any background for that TextBlock in order to not overlay the picture. – michalsol May 26 '16 at 15:37
  • @NahuelIanni I would like to show this text on image (which can have various colours), I would prefer not to use any background for that TextBlock in order to not overlay the picture. – michalsol May 26 '16 at 15:38
  • 2
    A better design would be to have a semi-transparent (`#33000000`) background (e.g. `Border`/`Rectangle`) on the image and then *white* text on the background. – Justin XL May 27 '16 at 00:40

0 Answers0