WPF TextBlock Color for each Character

后端 未结 1 1815
名媛妹妹
名媛妹妹 2021-01-01 14:10

how to get each character of a textblock of different color in wpf?

相关标签:
1条回答
  • 2021-01-01 14:52

    Use many different runs:

     <TextBlock FontSize="22">
                <Run Foreground="Gold">H</Run>
                <Run Foreground="Maroon">e</Run>
                <Run Foreground="Blue">l</Run>
                <Run Foreground="Orange">l</Run>
                <Run Foreground="Brown">o</Run>
            </TextBlock>
    

    This produce the result: enter image description here

    0 讨论(0)
提交回复
热议问题