wrapped text will keep center not left
有没有办法设置文本换行,以便文本块中的所有文本都是居中对齐的?
<ContentPresenter x:Name="CPMessage"
Content="{Binding BodyContent, ElementName=control, Mode=OneWay}"
Margin="32,0,32,36"
TextWrapping="WrapWholeWords"
HorizontalAlignment="Center"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
FontSize="16" />
答案 0 :(得分:1)
使用以下代码
轻松修复了它<TextBlock Text="{Binding BodyContent, ElementName=control, Mode=OneWay}"
TextWrapping="WrapWholeWords"
TextAlignment="Center" />
在COntentPresenter中添加代码