title: DataTemplateSelector issue
body: <p>In my Silverlight project, I needed to use <code>DataTemplateSelector</code>.
  I found a way to implement this (as it's not present in the framework) here : <a href="http://www.codeproject.com/KB/silverlight/SLTemplateSelector.aspx" rel="nofollow">http://www.codeproject.com/KB/silverlight/SLTemplateSelector.aspx</a></p>
  
  <p>This method has been working correctly in other places of my code, but this time it doesn't work.
  The problem is that the TemplateSelector is never called (I even tried to put a breakpoint in the constructor, but it was never hit).  Can you see a problem in my code ?  I used a debug converter, and could see that my <code>ListBox</code>'s <code>ItemsSource</code> is correctly set.</p>
  
  <p>Thanks in advance !</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;ListBox Name="DestinationsList" Grid.Column="2" ItemsSource="{Binding}"&gt;
  &lt;ListBox.ItemTemplate&gt;      
      &lt;DataTemplate&gt;
          &lt;helper:TargetTemplateSelector Content="{Binding}"&gt;
              &lt;helper:TargetTemplateSelector.FirstTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;TextBlock Text="Test1" /&gt;
                  &lt;/DataTemplate&gt;
              &lt;/helper:TargetTemplateSelector.FirstTemplate&gt;
              &lt;helper:TargetTemplateSelector.SecondTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;TextBlock Text="Test2" /&gt;
                  &lt;/DataTemplate&gt;
              &lt;/helper:TargetTemplateSelector.SecondTemplate&gt;
          &lt;/helper:TargetTemplateSelector&gt;
      &lt;/DataTemplate&gt;
  &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>TemplateSelector class:</p>
  
  <pre><code>public class TargetTemplateSelector : DataTemplateSelector
  {
      public DataTemplate FirstTemplate { get; set; }
      public DataTemplate SecondTemplate { get; set; }        
  
      public override DataTemplate SelectTemplate(object item, DependencyObject container)
      {
          MyClass1 target = item as MyClass1;
  
          if (target != null)
          {
              if (target.Profile is MyClass2)
              {
                  return this.FirstTemplate;
              }
              else if (target.Profile is MyClass3)
              {
                  return this.SecondTemplate;
              }
              else
              {
                  throw new NotImplementedException();
              }
          }
  
          return base.SelectTemplate(item, container);
      }
  }
  </code></pre>