How to make button's width autofit the text of a button?
.net, styles, wpf
Solution
What you have to do is set the HorizontalAlignment property to Center (or Right or Left). The buttons must be getting stretched by the containing Panel.
<Style TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="90" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
Problem
I am currently doing this, but I am doing something wrong :): ``` <Style TargetType="{x:Type Button}"> <Setter Property="MinWidth" Value="90" /> <Setter Property="Width" Value="Auto" /> </Style> ``` I want the buttons to have some minimum width but also to have their width expand to fit the text of the button.