Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try setting the <code>Padding</code> and <code>Margin</code> of the <code>TextBlock</code> to zero.</p> <pre><code>&lt;TextBlock Padding="0" Margin="0" ... /&gt; </code></pre> <p>Since you have multiple textblocks that you are going to want to do this with, you should probable use a <code>Style</code> to do this.</p> <pre><code>&lt;StackPanel Orientation="Horizontal"&gt; &lt;Style TargetType="TextBlock"&gt; &lt;Setter Property="Padding" Value="0" /&gt; &lt;Setter Property="Margin" Value="0" /&gt; &lt;/Style&gt; ... &lt;/StackPanel&gt; </code></pre> <p>If this doesn't help, then you could start using negative margins:</p> <pre><code>Margin="-1,0,0,0" </code></pre> <p>However this introduces brittleness into your code, because the spacing between text depends on the font size and the text displayed. For example, if you change the font size to 13, you will no longer have this problem with five lower case 'e'. Changing the text to uppercase 'E' will result in the same problem, though.</p> <p>You could try using the clipping properties on the <code>TextBlock</code> or even the rendering affects, but this seems like a lot of work just to get text to adjust a couple of pixels. May I ask why you are trying to get the two text samples to look the same?</p> <p><strong>Update:</strong> I am doubtful that you can find a good way to make this work the way that you want to. May you should look into using a <code>RichTextBox</code> or creating a custom control.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ff426926%28v=vs.95%29.aspx" rel="nofollow">Here</a> is a good example use of a <code>RichTextBox</code> with text highlight (although it is foreground highlighting).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload