WPF Textblock, linebreak in Text attribute

后端 未结 15 1391
南方客
南方客 2021-02-03 16:37

Is there a way to have \\n make a line break in a TextBlock?


Or is there a

15条回答
  •  無奈伤痛
    2021-02-03 16:55

    I was having a similar problem and wanted to bind a String of xaml markup to a TextBlock. Essentialy storing the declarative markup inside a TextBlock in a string for later use.

    This is how I did: I subclassed the TextBlock to make the InlineCollection bindable and wrote a Converter between the string and an InlineCollection(or actually a generic list of Inlines.)

提交回复
热议问题