views:

153

answers:

1

I'm trying to make a textblock control with a fixed size (height and width) in a window using Expression Blend, but the content of the textblock will be changed programatically, so I want the text to be viewed by the largest possible font size without going outside the size of the rectangle.

How to do that?

+3  A: 

Rather than changing the font size, ese a ViewBox - WPF Tutorial. It seems to be better equipped for what you are trying to achieve as it gives the control within it the ability to resize indefinitely to the size of the area in which you place it.

Kyle Rozendo
Agree. ViewBox is the way to go here.
Anvaka
thank you for your reployment, i've tried to work with the view box, but i dont want the size of the control to change !! it is as a constrain in the design that i'm trying to achieve .i need just to change the size of the font not the control itself !or i've miss anderstand you ?
alnabhani
If you set a fixed size on the Viewbox and Auto on the TextBlock it will automatically scale as the text changes length. It will appear that the font size is changing.
John Bowen
thanks alot, it works fine now !
alnabhani