emirate
emirate

Reputation: 159

Change font size on button

WPF on the form has a button when the button resizes the form changes the size. How would I change the font size on buttons when resizing the buttons?

Upvotes: 0

Views: 474

Answers (1)

Ray
Ray

Reputation: 46595

Put the text in a TextBlock inside a ViewBox.

<Button>
    <Viewbox>
        <TextBlock>Text</TextBlock>
    </Viewbox>
</Button>

Then add some margins to the ViewBox. You can adjust the Stretch and StretchDirection as required (i.e. do you want to text to be vertically stretched, or do you want the proportions to stay the same?). The default stretch is Uniform which is probably what you want.

Upvotes: 1

Related Questions