Set TextBlock to preserve white space at the beginning and at the end?
问题 EDIT: The code below actually works as I want - this question a little misleading. Please ignore it. Normally when I set Text property of TextBlock like this: TextBlock tb = new TextBlock(); tb.Text = " Hello World "; The whitespace at the beginning and at the end of text are not shown. The text shown by TextBlock is only Hello World . How can I set TextBlock to display them (i.e., not remove the whitespace)? Am I missing some property? 回答1: In this case you don't need to use xml:space=