title: Detect being last child control and change one property
body: <p>I have a stackpanel with many listboxes and all except the last one should have background visible. Is it possible to detect from ControlTemplate that listbox is the last child and set "Bd" opacity to 0. (MyListBox extends Listbox)</p>
  
  <pre><code>&lt;Style TargetType="{x:Type local:MyListBox}"&gt;
     &lt;Setter Property="Template"&gt;
        &lt;Setter.Value&gt;
           &lt;ControlTemplate TargetType="{x:Type local:MyListBox}"&gt;
               &lt;Grid &gt;
               ...
                  &lt;Border Grid.Row="0" x:Name="Bd"...&gt;
                     &lt;Border.Background&gt;
                        &lt;ImageBrush Stretch="Fill" ImageSource="/arrayProba1;component/bck/mybck.png" /&gt;
                     &lt;/Border.Background&gt; 
  </code></pre>
  
  <p>If I add another Listbox, the old one that was previously last child will get background and the new one will loose it setting "Bd" opacity 0 (will be animated later)</p>
  
  <pre><code>private List&lt;MyListBox&gt; MyPanels = new List&lt;MyListBox&gt;();
  
  MyPanels.Add(new MyListBox() { Title = "..." });
  MyPanelsHolder.Children.Add(MyPanels[n]);
  </code></pre>
  
  <p>I had it working creating whole style in code behind, but I need to do it this way. 
  How would you approach this problem?</p>