2015-10-23 2 views
0

Comment pourrais-je changer chacune des lignes de mon bloc de texte pour avoir des alignements différents? Jusqu'à présent, j'ai ce code mais je ne sais pas comment changer les deuxième et troisième.Comment puis-je changer la multiligne de mon bloc de texte pour avoir différents alignements de texte?

<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> 

Répondre

0

Cela produira un résultat similaire mais vous aurez plusieurs 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>