I just ran into a problem with XAML (WPF and Silverlight) and wanted to share my solution with you. In my Word to XAML converter application, I was noticing that sometimes extraneous spaces were being seen in Paragraph elements in WPF and TextBlock elements in Silverlight.
The problem was caused because I formatted my XAML with indentations so that it would look nice like this:
<Paragraph> <Run Text="gym"/> <Run Text="nasium"/> </Paragraph>
It turns out that elements that use the InlineCollection like Paragraph and TextBlock interpret invisible newline characters as spaces so that XAML would show the text “gym nasium”. See the article on MSDN.
To get the XAML to display the text correctly, you should not have spaces or newlines between elements in a Paragraph or TextBlock like this:
<Paragraph> <Run Text="gym"/><Run Text="nasium"/> </Paragraph>
This is typically not a problem when writing your own XAML but when you are creating XAML programmatically via XSLT, you can run into this issue.
I put my comment in the MSDN article (see the bottom) so that others can be helped by my experience. Have you ever added a comment to an MSDN article? Do you read the community comments in MSDN?