title: WPF DataTemplate and Binding
body: <p>I continue my understanding of MVVC with the <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" rel="noreferrer">code of MSDN</a> and I have a question.</p>
  
  <p>In the .xaml they have a list of commands displayed to the screen.</p>
  
  <pre><code>   &lt;Border 
      Grid.Column="0" 
      Style="{StaticResource MainBorderStyle}"
      Width="170"
      &gt;
      &lt;HeaderedContentControl
        Content="{Binding Path=Commands}"
        ContentTemplate="{StaticResource CommandsTemplate}"
        Header="Control Panel"
        Style="{StaticResource MainHCCStyle}"
        /&gt;
    &lt;/Border&gt;
  </code></pre>
  
  <p>From here, I understand that the DataContext is set (not shown here) and it will display the collection of Commands. What I do not understand is the CommandsTemplate that you can see below:</p>
  
  <pre><code>&lt;DataTemplate x:Key="CommandsTemplate"&gt;
  &lt;ItemsControl IsTabStop="False" ItemsSource="{Binding}" Margin="6,2"&gt;
    &lt;ItemsControl.ItemTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;TextBlock Margin="2,6"&gt;pou
          &lt;Hyperlink Command="{Binding Path=Command}"&gt;
            &lt;TextBlock Text="{Binding Path=DisplayName}" /&gt;
          &lt;/Hyperlink&gt;
        &lt;/TextBlock&gt;
      &lt;/DataTemplate&gt;
    &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>How does the binding is created? How this code tell to check the property Command and DisplayName from the object inside the collection? Is it from the ItemsSource? If yes, I do not understand why it's only at {Binding}. Anyone can explain me please how the DataTemplate binding work from a ContentTemplate?</p>