1

How can I automatically scale text inside a control based on the control's size but always make sure it's readable (that is, I want the font size stays between 9pt and 30pt)

Chris
  • 357
  • 4
  • 16

2 Answers2

2

The ViewBox can help with this, but I'm not sure about keeping the font size within a range. You can probably accomplish this roughly with MinHeight and MinWidth.

agent-j
  • 27,335
  • 5
  • 52
  • 79
  • No it doesn't. If viewbox has max height or max width, long text will look really small. – Chris Jun 30 '11 at 17:52
1

Try to use ScaleTransform. In order to understand how to calculate the scale size you may refer to http://social.msdn.microsoft.com/forums/en-US/wpf/thread/d73c9eb2-9c68-428d-b99b-d23d0c62c095/

Pradeep
  • 484
  • 5
  • 13