title: Incorrect pixel size for same height in ListView: how to enforce pixel height/size
body: <p>I have a <code>ListView</code> that hosts multiple instances of an user control in a C# WPF application.</p>
  
  <p>This user control displays a horizontal line that always has the same size "1".</p>
  
  <p>However on screen, the lines that should have the same height display with +/-1 pixel height difference!!!</p>
  
  <p><a href="https://i.stack.imgur.com/PFqHs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PFqHs.png" alt="First line is thicker"></a></p>
  
  <p><a href="https://i.stack.imgur.com/qB2n1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qB2n1.png" alt="First two lines are thinner!!!"></a></p>
  
  <p><strong>Question</strong>: How can I enforce that rendering will render the lines with the same PIXEL height?!</p>
  
  <p>Here the Line definition in the user control:</p>
  
  <p>Line definition of the user control:</p>
  
  <pre><code>&lt;Rectangle Grid.Row         = "1"
             Grid.Column      = "0"
             Grid.ColumnSpan  = "2"
             Fill             = "DodgerBlue"
             Height           = "1"
             Margin           = "0, 1, 0, 2" /&gt;
  </code></pre>
  
  <p>and the ListView:</p>
  
  <pre><code>&lt;ListView ItemsSource                   = "{Binding FoundBooks, Mode=OneWay}"
            SelectedItem                  = "{Binding SelectedBookPreview}"
            Grid.Row                      = "1" 
            Grid.Column                   = "0" 
            SelectionMode                 = "Single"
            HorizontalContentAlignment    = "Stretch"&gt;
  
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate DataType="{x:Type vm:vmLessonBookPreview}"&gt;
              &lt;ucont:ucLessonBookListViewItem DataContext         = "{Binding}"
                                              HorizontalAlignment = "Stretch" 
                                              Margin              = "-3, 0, -3, 0" /&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  
  &lt;/ListView&gt;
  </code></pre>
  
  <p>More notes;</p>
  
  <ul>
  <li>The line-height does only depend on the display position in the control, not on the index number (so first line will always have same size different than 2nd line for example, even when I scroll)</li>
  <li>Tested with <code>ListView</code>, <code>ItemsControl</code> and <code>ComboBox</code>, all the same issues</li>
  <li>Controls added manually in a <code>ScrollViewer</code> do not behave like this</li>
  <li>Using px sizes (e.g. <code>Height = "2px"</code> does not change anything!)</li>
  </ul>
  
  <p>It really seems to be an issue with the ItemsControl presenter, could it be a bug?</p>