TextBlock 文本居中问题

TextBlock 文本居中问题

在WPF设计时,设置HorizontalAlignment="Center"时,文本依然靠左显示,这时可以设置Block.TextAlignment="Center",这样文本就会居中显示了。

例如:

<TextBlock Text="操作" Width="80" VerticalAlignment="Center" Block.TextAlignment="Center"/>
posted @ 2022-11-17 16:22  修行的蜗牛  阅读(2678)  评论(0编辑  收藏  举报