문제

So I have a textblock that is receiving response text from a webclient

When I do this call in a browser I get nicely formatted responses

like this

enter image description here

but when I do this in code and push it into my textblock I get this (note that all the data is there just scrolled off of the screenshot)

enter image description here

Here is my textblock XAML

 <TextBlock xml:space="preserve"  Text="{Binding toolResponseText,Mode=TwoWay}"/>

I was hoping the space preserve line would have fixed this but it didn't.

도움이 되었습니까?

해결책

No, xml:space = preserve is talking about whitespace within the XAML. It's not useful to you here.

The important point is that the browser is displaying it with a monospaced font, whereas you're using a variable-width font.

Try:

FontFamily="Consolas"

within your XAML. (If that font family doesn't change the appearance, find another one which does, and is still monospaced...)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top