WPF button change content size

<Button Name="button" Content="Hello" Height="100" Width="200" Click="button_Click_2">

    <Button.ContentTemplate>

        <DataTemplate>

            <Viewbox>

                <TextBlock>MyButton</TextBlock>

            </Viewbox>

        </DataTemplate>

    </Button.ContentTemplate>

</Button>

Copy from https://social.msdn.microsoft.com/Forums/vstudio/en-US/188c196e-90d8-4584-bc62-38d7e008cf5c/how-do-i-resize-button-text-upon-button-resize?forum=wpf

 

posted @ 2020-07-21 11:50  Fred1987  阅读(53)  评论(0编辑  收藏