Kaveh Shahbazian
Kaveh Shahbazian

Reputation: 13513

Re-sizing Text According to Re-sized Container

Assume I have a re-sizable part in UI that is a standard WPF container control (in this case a Canvas) and I put some text on this Canvas. How can I re-size my text according to rendered size of my Canvas?

Upvotes: 0

Views: 78

Answers (2)

paparazzo
paparazzo

Reputation: 45096

Viewbox will stretch a TextBlock

How to: Apply Stretch Properties to the Contents of a Viewbox

<Viewbox Grid.Row="1" Grid.Column="1" Name="vb1" Stretch="Fill" >
    <TextBlock Text="tulip_farm.jpg"/>
</Viewbox>

Upvotes: 1

Freeman
Freeman

Reputation: 5801

You can simply link a method to the container resize event, that will resize the text as well (this way they are always in sync), i would offer an example but since you did not post an example, i think you undetrstand what i mean.

Upvotes: 0

Related Questions