title: WPF ContentPresenter inside an ItemsControl.ItemTemplate
body: <p>I have two user controls, WorkflowTileItemsControl and WorkflowTileControl.  The WorkflowTileItemsControl hosts the WorkflowTileControl in an ItemsControl.  However, there are dependency properties on the WorkflowTileControl that I would like to expose to anything using the WorkflowTileItemsControl.  In order to do that here is ItemsControl code for WorkflowTileItemsControl.</p>
  
  <pre><code>&lt;ItemsControl ItemsSource="{Binding Source={StaticResource WorkflowTilesViewSource}}"&gt;
    &lt;ItemsControl.ItemsPanel&gt;
      &lt;ItemsPanelTemplate&gt;
        &lt;WrapPanel /&gt;
      &lt;/ItemsPanelTemplate&gt;
    &lt;/ItemsControl.ItemsPanel&gt;
    &lt;ItemsControl.ItemTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;ContentPresenter Content="{Binding WorkflowTileControl, ElementName=ctrlWorkflowTileItems}" /&gt;
      &lt;/DataTemplate&gt;
    &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>However this doesn't seem to work.  It is only showing the last item in the ItemsControl.  Below is code that works, and is the functionality I'm looking for (minus hard coding all the dependency properties).</p>
  
  <pre><code>&lt;ItemsControl ItemsSource="{Binding Source={StaticResource WorkflowTilesViewSource}}"&gt;
    &lt;ItemsControl.ItemsPanel&gt;
      &lt;ItemsPanelTemplate&gt;
        &lt;WrapPanel /&gt;
      &lt;/ItemsPanelTemplate&gt;
    &lt;/ItemsControl.ItemsPanel&gt;
    &lt;ItemsControl.ItemTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;OrderCommon:WorkflowTileControl IsReadOnly="True" Margin="5" TasksTitle="Defects" /&gt;
      &lt;/DataTemplate&gt;
    &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>And this is what my calling code looks like.</p>
  
  <pre><code>&lt;OrderCommon:WorkflowTileItemsControl WorkflowRequirementTypeCode="DISBURSEMENTDFCT" Margin="5" MinWidth="1000" MaxWidth="1250" HorizontalAlignment="Left"&gt;
    &lt;OrderCommon:WorkflowTileItemsControl.WorkflowTileControl&gt;
      &lt;OrderCommon:WorkflowTileControl IsReadOnly="True" Margin="5" TasksTitle="Defects" /&gt;
    &lt;/OrderCommon:WorkflowTileItemsControl.WorkflowTileControl&gt;
  &lt;/OrderCommon:WorkflowTileItemsControl&gt;
  </code></pre>
  
  <p>I feel like there is some simple step I'm missing.  I'm not sure if ContentPresenter is the right tool for the job.  I haven't done anything like this in WPF before.  Can someone please assist?</p>