title: C# WPF: prevent last item cover by horizontal scrollbar in ListView with Height property set to "Auto"
body: <p>I have a WPF ListView inside StackPanel, with Height="Auto". It's great that it does what I wanted to - changes it's height according to the all items contained in ListView. I have also HorizontalScrollBarVisiblity="Auto" on my ListView, which suits my needs. </p>
  
  <p>The problem occurs when the whole width of columns of my ListView is greater than width of ListView control (i.e. user decreases width of a window and this control). In that case obviously horizontal scrollbar appears - thats ok. The problem is that this scrollbar covers last (bottom) item of the ListView's items so it is partially not visible. </p>
  
  <p>Vertical scrollbar doesn't appear and this is ok - I don't want it. I just want to have my ListView height beeing calculated properly, so it considers the height of shown horizontal scrollbar and includes it in calculation so all items are wholy visible.</p>
  
  <p>Xaml code example:</p>
  
  <pre><code>&lt;ListView Name="lvProcedures" ItemsSource="{Binding Path=Procedures}" SelectionMode="Single"&gt;
   &lt;ListView.View&gt;
       &lt;GridView AllowsColumnReorder="False" ColumnHeaderToolTip="Lista zabiegów"&gt;
           &lt;GridViewColumn DisplayMemberBinding="{Binding Path=procedure}" Header="A" Width="150" /&gt;
           &lt;GridViewColumn DisplayMemberBinding="{Binding Path=location}" Header="B" Width="100" /&gt;
           &lt;GridViewColumn DisplayMemberBinding="{Binding Path=material}" Header="C" Width="180" /&gt;
           &lt;GridViewColumn DisplayMemberBinding="{Binding Path=other}" Header="D" Width="180" /&gt;
           &lt;GridViewColumn DisplayMemberBinding="{Binding Path=description}" Header="E" Width="400" /&gt;
       &lt;/GridView&gt;
    &lt;/ListView.View&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>I've now hanged on idea to create user control (maybe only ListView's derieved class??) which overrides MeasureOverride but I don't think it is good way to solve such a small but iritating "bug" and it also still makes me trouble to implement the solution.</p>
  
  <p>Can somebody provide some elegant solution for this problem?
  Any idea would be appreciated.</p>