title: Datagrid not showing data in wpf with c#
body: <p>I am trying to use a dataGrid in WPF with c#. But I cannot get my datagrid to show any of my data in the table when I run my program in debug mode. I have this code executing when the datagrid loads. But all I see is an empty square.</p>
  
  <pre><code>private void dataGrid1_Loaded(object sender, RoutedEventArgs e)
  {
      var items = new List&lt;SaveTable&gt;();
  
      items.Add(new SaveTable("A" , 0));
      items.Add(new SaveTable("B" , 0));
      items.Add(new SaveTable("C" , 0));
      items.Add(new SaveTable("D" , 0));
      items.Add(new SaveTable("E" , 0));
  
      var grid = sender as DataGrid;
      grid.ItemsSource = items;    
  }
  </code></pre>
  
  <p>I save a class named SaveTable which looks like this:</p>
  
  <pre><code>class SaveTable
  {
  
      public string Name { get; set; }
      public double Value { get; set; }
  
      public SaveTable(string name, double value)
      {
          this.Name = name;
          this.Value = value;
      }
  }
  </code></pre>
  
  <p>I got this code format online and it seems like everything is right? any suggestions?</p>
  
  <p>here is the xaml code for that window</p>
  
  <pre><code>&lt;Window x:Class="RobustCalculator.Storage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Storage" Height="499" Width="546" Activated="Window_Activated" Loaded="Window_Loaded"&gt;
  &lt;Grid&gt;
      &lt;TextBlock Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="textBlock1" Text="A" VerticalAlignment="Top" /&gt;
      &lt;TextBox HorizontalAlignment="Left" Margin="24,10,0,306" Name="valueA" Width="120" TextChanged="valueA_TextChanged" /&gt;
      &lt;TextBox Height="23" HorizontalAlignment="Left" Margin="24,39,0,0" Name="valueB" VerticalAlignment="Top" Width="120" TextChanged="valueB_TextChanged" /&gt;
      &lt;TextBlock Height="20" HorizontalAlignment="Left" Margin="10,42,0,0" Name="textBlock2" Text="B" VerticalAlignment="Top" Width="20" /&gt;
      &lt;TextBox Height="23" HorizontalAlignment="Left" Margin="24,71,0,0" Name="valueC" VerticalAlignment="Top" Width="120" TextChanged="valueC_TextChanged" /&gt;
      &lt;TextBlock Height="23" HorizontalAlignment="Left" Margin="10,72,0,0" Name="textBlock3" Text="C" VerticalAlignment="Top" /&gt;
      &lt;TextBlock Height="23" HorizontalAlignment="Left" Margin="10,101,0,0" Name="textBlock4" Text="D" VerticalAlignment="Top" /&gt;
      &lt;TextBox Height="23" HorizontalAlignment="Left" Margin="24,98,0,0" Name="valueD" VerticalAlignment="Top" Width="120" TextChanged="valueD_TextChanged" /&gt;
      &lt;TextBox Height="23" HorizontalAlignment="Left" Margin="24,130,0,0" Name="valueE" VerticalAlignment="Top" Width="120" TextChanged="valueE_TextChanged" /&gt;
      &lt;TextBlock Height="23" HorizontalAlignment="Left" Margin="11,131,0,0" Name="textBlock5" Text="E" VerticalAlignment="Top" /&gt;
      &lt;DataGrid AutoGenerateColumns="False" Height="200" HorizontalAlignment="Left" Margin="235,130,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="200" SelectionChanged="dataGrid1_SelectionChanged" Loaded="dataGrid1_Loaded" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>I added a breakpoint and the code isn't being executed. I am using the Loaded event, should I be using a different event?</p>