Chris
Chris

Reputation: 357

Scale text in WPF

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)

Upvotes: 1

Views: 1628

Answers (2)

Pradeep
Pradeep

Reputation: 484

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/

Upvotes: 1

agent-j
agent-j

Reputation: 27943

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.

Upvotes: 2

Related Questions