title: WPF DataGrid binding does not show values
body: <p>I am a total beginner with WPF and I try to make binding to DataGrid in WPF.</p>
  <p>XAML code:</p>
  <pre><code>&lt;Grid x:Name=&quot;LayoutRoot&quot;&gt;
      &lt;Grid HorizontalAlignment=&quot;Left&quot; Height=&quot;440&quot; VerticalAlignment=&quot;Top&quot;
          Width=&quot;632&quot;&gt;
          &lt;DataGrid HorizontalAlignment=&quot;Left&quot; Height=&quot;420&quot; Margin=&quot;10,10,0,0&quot;
              VerticalAlignment=&quot;Top&quot; Width=&quot;603&quot; ItemsSource=&quot;{Binding
              Source=MailCollection}&quot; AutoGenerateColumns=&quot;False&quot;&gt;
              &lt;DataGrid.Columns&gt;
                  &lt;DataGridTextColumn  Header=&quot;id&quot; Binding=&quot;{Binding Id}&quot;/&gt;
                  &lt;DataGridTextColumn  Header=&quot;nazwa&quot; Binding=&quot;{Binding Name}&quot;/&gt;
              &lt;/DataGrid.Columns&gt;
          &lt;/DataGrid&gt;
      &lt;/Grid&gt;
  &lt;/Grid&gt;
  </code></pre>
  <p>Here is <code>MailTpl</code> class:</p>
  <pre><code>public class MailTpl
  {
      public string Id { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  <p>And here is how I do binding:</p>
  <pre><code>public partial class WindowDataGridTest : Window
  {
      ObservableCollection&lt;MailTpl&gt; _MailCollection =
          new ObservableCollection&lt;MailTpl&gt;();
      public ObservableCollection&lt;MailTpl&gt; MailCollection
          { get { return _MailCollection; } }
  
      public WindowDataGridTest()
      {
          _MailCollection.Add(new MailTpl
              { Id= &quot;abbb&quot;, Name = &quot;badfasdf&quot; });
          _MailCollection.Add(new MailTpl
              { Id = &quot;asasdfasdfdf&quot;, Name = &quot;basdfasdfaa&quot; });
          this.InitializeComponent();
          // Insert code required on object creation below this point.
      }
  }
  </code></pre>
  <p>I don't know why it does not work. Any clues? Grid shows no values.</p>