title: Use different template for last item in a WPF itemscontrol
body: <p>I'm using a custom template in my itemscontrol to display the following result:</p>
  
  <pre><code>item 1, item 2, item3,
  </code></pre>
  
  <p>I want to change the template of the last item so the result becomes:</p>
  
  <pre><code>item 1, item2, item3
  </code></pre>
  
  <p>The ItemsControl:</p>
  
  <pre><code>&lt;ItemsControl ItemsSource="{Binding Path=MyCollection}"&gt;
  
      &lt;ItemsControl.ItemsPanel&gt;
          &lt;ItemsPanelTemplate&gt;
              &lt;StackPanel Orientation="Horizontal" IsItemsHost="True"/&gt;
          &lt;/ItemsPanelTemplate&gt;
      &lt;/ItemsControl.ItemsPanel&gt;
  
      &lt;ItemsControl.ItemTemplate&gt;
          &lt;DataTemplate&gt;
  
              &lt;StackPanel Orientation="Horizontal"&gt;
                  &lt;TextBlock Text="{Binding Path=Name}"/&gt;
                  &lt;TextBlock Text=", "/&gt;
              &lt;/StackPanel&gt;
  
          &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>Is there anyone who can give a solution for my problem? Thank you!</p>