Why does TextBlock trims ending spaces from the text?

后端 未结 5 2079
粉色の甜心
粉色の甜心 2021-02-19 01:18

Here is my TextBlocks


    

        
5条回答
  •  清酒与你
    2021-02-19 01:28

    It looks like xml:space="preserve" should do the trick (see Preserving Whitespace in XAML) but that doesn't seem to be working in a Windows Store app (it does in WPF).

    If you use the non-breaking space character   it does work

     

    I suppose you could try building a converter on the Text property to check for trailing spaces and replace with non-breaking spaces - presuming the truncation that's happening doesn't occur too early.

提交回复
热议问题