Jakub Szułakiewicz
Jakub Szułakiewicz

Reputation: 840

Auto-size text on button

I have a window with few buttons.

The buttons are auto-sized, in order to fill all avaible space. It works.

BUT size of the text on these buttons is fixed.

I want to make this text as large, as possible.

How to achieve this?

Upvotes: 0

Views: 2743

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

You can do something like this, Wrap the content inside a ViewBox

<Button Name="button" Content="Hello" Height="100" Width="200" >
    <Button.ContentTemplate>
        <DataTemplate>
            <Viewbox>
                <TextBlock>MyButton</TextBlock>
            </Viewbox>
        </DataTemplate>
    </Button.ContentTemplate>
</Button>

Upvotes: 2

Related Questions