shady
shady

Reputation: 1106

WP 8.1 text scaling

So say I have a textblock with a fontsize 32. The value of the text property is a variable amount of characters. If the text at a fontsize of 32 is cut off, how could i down scale the fontsize until the total width of the textblock is equal to the page width?

-I'd post a screenshot but not enough rep :/

Upvotes: 0

Views: 280

Answers (1)

Juan Pablo Garcia Coello
Juan Pablo Garcia Coello

Reputation: 3232

The best solution is insert the TextBlock inside a fix width ViewBox:

 <Viewbox Width="300" StretchDirection="Both" >
    <TextBlock x:Name="testblock" Foreground="Magenta" FontSize="24" Text="This is a test"/>
    </Viewbox>

And that will make the job without any effort. Change the parameters depending you need, and you can insert the textblock inside a border,etc.

Upvotes: 1

Related Questions