title: get ItemsControl in ItemCollection CollectionChanged event
body: <p>my itemscontrol :</p>
  
  <pre><code> &lt;ItemsControl x:Name="MyItemsControl"  Style="{StaticResource ItemsControlStyle}" /&gt;
  
   &lt;Style TargetType="{x:Type ItemsControl}" x:Key="ItemsControlStyle"&gt;
        &lt;Setter Property="ItemTemplate" Value="{StaticResource ItemsControlDataItem}"&gt;&lt;/Setter&gt;
   &lt;/Style&gt;
  
   &lt;DataTemplate x:Key="ItemsControlDataItem" &gt;
        &lt;Ellipse Width="45" Height="45"&gt;&lt;/Ellipse&gt;
   &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>iv'e hooked an event to see when the underlying collection as changed :</p>
  
  <pre><code> ((INotifyCollectionChanged)MyItemsControl.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(ClientWindow_CollectionChanged);
  </code></pre>
  
  <p>the first thing i need is a way to extract the ItemsControl which owns this ItemCollection</p>
  
  <p>the second thing is to traverse all the data items as their DataTemplate , i.e. as Ellipse 
  since i wan't to perform some Transformation on them .</p>
  
  <pre><code>   void ClientWindow_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
     {
          // here i need to traverse and make my change , how do i extract the ellipse items  
          // how do i get the itemsControl associated with the ItemCollection which triggered this event                
              ItemCollection collection = sender as ItemCollection ;
              foreach (object item in collection)
              {
                  //  here i would need the ellipse that the object represents 
                  // EDIT : i'm guessing this is how i would get the ellipse    
                  // but how would i get the itemsControl ?
                  var ellipse = _itemsControl.ItemContainerGenerator.ContainerFromItem(item ) as Ellipse;
              }                    
     }
  </code></pre>
  
  <p>so just to clarify i wan't to traverse the collection and extract the underlying type assigned through the datatemplate .</p>