How to get rid of whitespace between Runs in TextBlock?

后端 未结 6 640
情深已故
情深已故 2020-12-08 01:39

I have following XAML:



        
6条回答
  •  我在风中等你
    2020-12-08 02:19

    The spaces between the run tags cause the spaces, this is the easiest fix.

            
          
    
    

    Because anything between the and is targeting the text property of the TextBlock the whitespace from the breaks between the runs causes the effect you see. You could also shorten it to this.

    +
    

    This MSDN article gives all the specifics on how xaml handles the whitespace

    http://msdn.microsoft.com/en-us/library/ms788746.aspx

    If you were curious why a break and a ton of tabs translates into a single space

    All whitespace characters (space, linefeed, tab) are converted into spaces.

    All consecutive spaces are deleted and replaced by one space

提交回复
热议问题