我目前正在这样做,但我做错了:):
<Style TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="90" />
<Setter Property="Width" Value="Auto" />
</Style>
Run Code Online (Sandbox Code Playgroud)
我希望按钮具有一些最小宽度,但也要使其宽度扩展以适合按钮的文本.
Ale*_*sky 17
您需要做的是将HorizontalAlignment属性设置为Center(或Right或Left).按钮必须由包含的面板拉伸.
<Style TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="90" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16913 次 |
最近记录: |