如何更改每个文本块的行以进行不同的对齐?到目前为止,我有这个代码,但我不知道如何更改第二个和第三个。
<TextBlock Margin="0" Foreground="Red" TextAlignment="Left">
<Run Text="First Line (Left)"/><LineBreak />
<Run Text="Second Line (Center)"/><LineBreak />
<Run Text="Third Line (Right)"/><LineBreak />
</TextBlock>
答案 0 :(得分:0)
这将产生类似的结果,但是你将有多个TextBlocks:
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Vertical">
<TextBlock Text="First Line (Left)" Margin="0" Foreground="Red" TextAlignment="Left"/>
<TextBlock Text="Second Line (Center)" Margin="0" Foreground="Red" TextAlignment="Center"/>
<TextBlock Text="Third Line (Right)" Margin="0" Foreground="Red" TextAlignment="Right"/>
</StackPanel>
</StackPanel>