title: Data binding from a complex ICollectionView in a WPF ItemContainerStyle
body: <p>I have the following xaml:</p>
  
  <pre><code>&lt;UserControl ... xmlns:dd="clr-namespace:AttachedBehaviours.DragDrop;assembly=AttachedBehaviours" ... &gt;
      &lt;UserControl.Resources&gt;
          &lt;dd:BindingProxy x:Key="library_proxy"
                           Binding="{Binding SelectedItems.Count, ElementName=library}" /&gt;
      &lt;/UserControl.Resources&gt;
      &lt;ListView x:Name="library" ItemsSource="{Binding View}"&gt;
          &lt;ListView.View&gt;
              &lt;GridView&gt;
                  &lt;GridView.Columns&gt;
                      &lt;GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" /&gt;
                      &lt;GridViewColumn Header="Value" DisplayMemberBinding="{Binding Value}" /&gt;
                  &lt;/GridView.Columns&gt;
              &lt;/GridView&gt;
          &lt;/ListView.View&gt;
          &lt;ListView.ItemContainerStyle&gt;
              &lt;Style TargetType="ListViewItem"&gt;
                  &lt;Setter Property="dd:DragDropMulti.DragDropPreviewControl"&gt;
                      &lt;Setter.Value&gt;
                          &lt;dd:DragDropPreviewBase&gt;
                              &lt;dd:DragDropPreviewBase.Template&gt;
                                  &lt;ControlTemplate TargetType="dd:DragDropPreviewBase"&gt;
                                      &lt;TextBlock x:Name="tblk__preview"
                                                 Text="{Binding Binding, Source={StaticResource library_proxy}}" /&gt;
                                      &lt;ControlTemplate.Triggers&gt;
                                          &lt;DataTrigger Binding="{Binding Binding, Source={StaticResource library_proxy}}"
                                                       Value="1"&gt;
                                              &lt;DataTrigger.Setters&gt;
                                                  &lt;Setter TargetName="tblk__preview"
                                                          Property="Text"
                                                          Value="{Binding Name}" /&gt;
                                              &lt;/DataTrigger.Setters&gt;
                                          &lt;/DataTrigger&gt;
                                      &lt;/ControlTemplate.Triggers&gt;
                                  &lt;/ControlTemplate&gt;
                              &lt;/dd:DragDropPreviewBase.Template&gt;
                          &lt;/dd:DragDropPreviewBase&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
              &lt;/Style&gt;
          &lt;/ListView.ItemContainerStyle&gt;
      &lt;/ListView&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>The problem I'm having is that if I generate my <code>ICollectionView</code> (the "View" in <code>ItemsSource="{Binding View}"</code>) with a basic <code>CollectionViewSource</code>, everything works as expected. E.g.:</p>
  
  <pre><code>View = new CollectionViewSource { Source = Models }.View;
  </code></pre>
  
  <p>However, if I use something more complex, the <code>Setter</code> binding of the <code>DataTrigger</code> doesn't work. E.g.:</p>
  
  <pre><code>View =
      new CollectionViewSource
      {
          Source =
              Models
                  .Join(
                      Lookups
                      , model =&gt; model.ID
                      , lookup =&gt; lookup.Key
                      , (model, lookup) =&gt;
                          new ComplexModel
                          {
                              ID = model.ID,
                              Name = model.Name,
                              Value = lookup.Value
                          }
                  )
      }
      .View;
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>System.Windows.Data Error: 40 : BindingExpression path error: 'Name' property not found on 'object' ''MainWindowViewModel' (HashCode=17911681)'.
  </code></pre>
  
  <p><code>MainWindowViewModel</code> is the overall <code>DataContext</code> (outside of the <code>UserControl</code>), so it's as though the <code>DataContext</code> has not been set.</p>
  
  <p>Why would this be the case?</p>