[WPF] Change the text in the Button according to the Button size

less than 1 minute read


When you put a button in a window that can be resized in WPF
How to change the text size according to the button size.
Not only the text but also the buttons inside the buttons are fine. (I think it’s rare …)

I didn’t know the existence of ViewBox
If there is a similar person.



<Window ~~~abridgement~~~ >
        <Button Grid.Row="0">
                <TextBlock>Variable size</TextBlock>
        <Button Grid.Row="1">
Fixed size

Tags: ,