Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic TextSize in WPF UIElements

As suggested I allow all of my WPF UIElements to have a dynamic size so they can be resized easily however, in TextBlocks I have to specify the size of the Font. This means when the element's size increases or decreases the Font size stays the same. Is there a way for the Font size to be dynamic?

like image 580
James Avatar asked Dec 10 '22 20:12

James


1 Answers

Try putting the text inside the control into a Viewbox:

<Button>
    <Viewbox>
        <TextBlock>Text To Resize</TextBlock>
    </Viewbox>
</Button>
like image 134
Simon Avatar answered Dec 27 '22 15:12

Simon