Multiple Colors In TextBlock

后端 未结 4 1405
名媛妹妹
名媛妹妹 2020-12-16 21:23

Is it possible to add dynamic colors to a TextBlock ..i.e. have one character in one color and the next in another color.



        
4条回答
  •  [愿得一人]
    2020-12-16 21:58

    Actually, you can, which can come in handy when you're doing a StringFormat on a data bound Textblock or a number of other places.

    If you did want to try it though, like here's an SL example for a form label that puts a red asterisk next to the text Required Fields, but then can also add more stuff to it as shown in the example. Should work for Silverlight, WPF, UWP, etc...

    
          
          
          
          
    
    

提交回复
热议问题