title: How can I get StackPanel to use an ItemTemplate?
body: <p>In the following code, I tell the <strong>ComboBox</strong> to use the DataTemplate called CustomerTemplate by assigning its <strong>ItemTemplate</strong> attribute.</p>
  
  <p><strong>StackPanel</strong>, however, doesn't have an ItemTemplate attribute.</p>
  
  <p><strong>How can I get the StackPanel to also use CustomerTemplate?</strong></p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;DataTemplate x:Key="CustomerTemplate"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;TextBlock Text="{Binding FirstName}"/&gt;
              &lt;TextBlock Text=" "/&gt;
              &lt;TextBlock Text="{Binding LastName}"/&gt;
          &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  &lt;/Window.Resources&gt;
  
  &lt;DockPanel LastChildFill="False" Margin="10"&gt;
      &lt;ComboBox 
          x:Name="CustomerList"
          ItemTemplate="{StaticResource CustomerTemplate}"
          HorizontalAlignment="Left"
          DockPanel.Dock="Top" 
          Width="200"
          SelectedItem="{Binding SelectedCustomer, Mode=TwoWay}"
          ItemsSource="{Binding Customers}"/&gt;
  
      &lt;StackPanel DataContext="{Binding SelectedCustomer}" Orientation="Horizontal"&gt;
          &lt;TextBlock Text="Chosen: "/&gt;
          &lt;TextBlock Text="{Binding LastName}"/&gt;
      &lt;/StackPanel&gt;
  
  &lt;/DockPanel&gt;
  </code></pre>