title: wpf listview/gridview: hiding repeated content
body: <p>I'm new to WPF and don't know how to implement what I need.</p>
  
  <p>My problem:</p>
  
  <p>I've got a data bound WPF gridview displaying the results of an SQL query.
  Some of the columns present repeated data that I'd like to hide.
  This:</p>
  
  <pre><code>occupancy   name       room
  ---------   ---------  -----
  Occupied    Bob        1
  Occupied    Ted        2
  Available              3
  Available              4
  </code></pre>
  
  <p>Should look like this:</p>
  
  <pre><code>occupancy   name       room
  ---------   ---------  -----
  Occupied    Bob        1
              Ted        2
  Available              3
                         4
  </code></pre>
  
  <p>My environment:</p>
  
  <p>Using C# on .net 3.5. I've bound the listview to a dataview collection. I have a data template for the cells to control the formatting.</p>
  
  <p>My tenative solution:</p>
  
  <p>I thought I should apply a trigger to the template and change the properties to make the text empty on all rows after the first where the data is the same as the previous row.</p>
  
  <p>When I setup the trigger can I perform this all in xaml or do I need to write code to access the previous row?</p>
  
  <p>If it's in XAML how do you construct the binding string(s) to reference the columns in the current and previous rows of the dataview it's bound to? Will it choke on the first row since there is no previous row?</p>
  
  <p>here's the template I'm working with:</p>
  
  <pre><code>&lt;DataTemplate x:Key="Occupancy"&gt;
      &lt;TextBlock Name="Occupancy" Text="{Binding Path=Occupancy}" TextAlignment="Left" /&gt;
      &lt;DataTemplate.Triggers&gt;
          &lt;DataTrigger Binding="{Binding Path=Occupancy}"&gt;
              &lt;DataTrigger.Value&gt;Available&lt;/DataTrigger.Value&gt;
              &lt;Setter TargetName="Occupancy" Property="**{previous column's content}**" Value="**{current columns content}**"/&gt;
          &lt;/DataTrigger&gt;
      &lt;/DataTemplate.Triggers&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>Maybe use RelativeSource:PreviousData ??</p>
  
  <p>If I have to write code does anyone know of a decent tutorial that would get me started?</p>
  
  <p>Alternative solutions are ok, though I think a no-code style that I could apply to many columns would be the optimal solution.</p>
  
  <p>Thanks for your time.</p>
  
  <p>Jay</p>