wpf 对齐按钮内容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/941672/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:30:31 来源:igfitidea点击:
Align button content
提问by Jose
I want the content of a wpf button to be left aligned I tried the following but the text is still centered inside the button.
我希望 wpf 按钮的内容左对齐我尝试了以下操作,但文本仍然在按钮内居中。
<Button >
<StackPanel HorizontalAlignment="Stretch">
<TextBlock HorizontalAlignment="Left" Text="Save"/>
</StackPanel>
</Button>
What do i do?
我该怎么办?
回答by Jose
回答by Bryan Anderson
You don't need the StackPanel or the TextBlock. All you need is
您不需要 StackPanel 或 TextBlock。所有你需要的是
<Button HorizontalContentAlignment="Left" Content="Save" />