5

as the title says, I would like to have a black font with a white border in my TextBox.

How could it be achieved?

Cheers.

Jamie
  • 1,092
  • 3
  • 22
  • 44

4 Answers4

3

It's possible to convert text into geometry objects with advanced formatting like outlines and fills for individual letters - you can find out more about how to do that here.

Having said that, I'm not sure that this is possible inside a TextBox. It may be for read-only text (TextBlock) only.

Edit

This blog post shows some advanced font rendering techniques inside a TextBox. It may be handy for you.

Matt Hamilton
  • 200,371
  • 61
  • 386
  • 320
  • Also read these two http://msdn.microsoft.com/en-us/library/ms745816.aspx and http://stackoverflow.com/questions/93650/apply-stroke-to-a-textblock-in-wpf/97728#97728 – Tom Dec 01 '10 at 23:44
3

What I always do for that is set the font color to white and set a DropShadow effect on the text.

Next, play around with depth, angle (set to 0 or something) and blur and you should be able to get what you want.

danbord
  • 3,605
  • 3
  • 33
  • 49
2

Check out Blacklight controls @ http://blacklight.codeplex.com/. In particular look at the sample on http://mightymeaty.members.winisp.net/blacklight.silverlight/ | Visual Controls | TEXT | Stroke Text Block (Alpha).

Todd Main
  • 28,951
  • 11
  • 82
  • 146
  • @Jamie: were you ever able to implement/use Blacklight for this need? – Todd Main Jan 10 '11 at 16:35
  • I didn't use the Blacklight finally, however while looking at the code I found the solution suitable for me. Thus I can consider your answer as a good one. :) – Jamie Jan 11 '11 at 01:25
1

A full class and example using Geometries:

http://blogs.msdn.com/b/wpfsdk/archive/2006/12/24/using-text-as-a-decorative-graphic.aspx

skybluecodeflier
  • 1,339
  • 13
  • 26