title: XAML template binding in Windows 8
body: <p>I am walking through Windows Store Sample Application XAML Twitter Client 1, to get the same features in my own application. But i can't get binding work in 1 to 1 sample page.</p>
  
  <p>This is my grid for displaying friends:</p>
  
  <pre><code>  &lt;GridView x:Name="FriendsGrid" 
                    Grid.Row="2" 
                    Grid.Column="1" 
                    HorizontalAlignment="Left" 
                    VerticalAlignment="Top" 
                    Margin="10,10,0,0"
                    ItemsSource="{Binding Friends}" 
                    ItemTemplate="{StaticResource FriendItemTemplate}" 
                    Grid.ColumnSpan="2"&gt;
          &lt;GridView.DataContext&gt;
              &lt;Model:FriendsViewModel/&gt;
          &lt;/GridView.DataContext&gt;
  </code></pre>
  
  <p>Template for binding: </p>
  
  <pre><code>&lt;Page.Resources&gt;
      &lt;DataTemplate x:Key="FriendItemTemplate"&gt;
          &lt;Grid Height="200" Width="300"&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition/&gt;
                  &lt;RowDefinition/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition/&gt;
                  &lt;ColumnDefinition/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
  
              &lt;Image HorizontalAlignment="Left" 
                         Height="80" Width="130" 
                         Margin="10,10,0,0" 
                         VerticalAlignment="Top" 
                         Source="{Binding RealPhoto}" 
                         Stretch="UniformToFill"/&gt;
  
              &lt;TextBlock Grid.Column="1" 
                             HorizontalAlignment="Left" 
                             Margin="10,10,0,0" 
                             TextWrapping="Wrap" 
                             VerticalAlignment="Top" 
                             Height="80" 
                             Width="130" 
                             Text="{Binding FirstName}"/&gt;
  
              &lt;TextBlock HorizontalAlignment="Left"
                             Margin="10,10,0,0" 
                             Grid.Row="1" 
                             TextWrapping="Wrap"
                             Text="{Binding LastName}"
                             VerticalAlignment="Top"
                             Width="280" Height="80"
                             Grid.ColumnSpan="2" /&gt;
          &lt;/Grid&gt;
      &lt;/DataTemplate&gt;
  &lt;/Page.Resources&gt;
  </code></pre>
  
  <p>In my code-behind file:</p>
  
  <pre><code>    private FriendsViewModel _model;
  
      public MyPage()
      {
          this.InitializeComponent();
          _model = new FriendsViewModel();
  
          FriendsGrid.DataContext = _model;
      }
  </code></pre>
  
  <p>Than i populate model, in application i see exactly the same items count that i`ve added, but items are empty. Using debug i see, that model is not empty.
  Also when i am hard-coding values in templates, they are visible.</p>
  
  <p><a href="https://github.com/xyligan/App3" rel="nofollow">Test project on GitHub</a></p>