title: Filling dataGrid with LINQ returned IEnumerable?
body: <p>I am trying to fill a datagrid (called dgDeelnemers) with the data from my databank, which I get using the following LINQ method.</p>
  
  <pre><code>[OperationContract]
  public IEnumerable&lt;Inschrijvingen&gt; getInschrijvingen()
  {
      var query = (from p in dc.Inschrijvingens select p);
  
      IEnumerable&lt;Inschrijvingen&gt; i = query;
  
      return i;
  }
  </code></pre>
  
  <p>And then I assign the data to my datagrid in the view using the following code.</p>
  
  <pre><code>  public partial class Deelnemers : UserControl
      {
          public Deelnemers()
          {
              InschrijvingenServiceClient client = new InschrijvingenServiceClient();
  
              client.getInschrijvingenCompleted += new EventHandler&lt;getInschrijvingenCompletedEventArgs&gt;(client_getInschrijvingenCompleted);
              client.getInschrijvingenAsync();
          }
  
          void client_getInschrijvingenCompleted(object sender, getInschrijvingenCompletedEventArgs e)
          {
  
              if (e.Error != null)
                  lblDeelnemers.Content = e.Error.ToString();
              else
                  dgDeelnemers.ItemsSource = e.Result;
          }
      }
  </code></pre>
  
  <p>But when I navigate to the page I get the following error: </p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object. at
    OndernemersAward.Views.Deelnemers.client_getInschrijvingenCompleted(Object
    sender, getInschrijvingenCompletedEventArgs e)    at
    OndernemersAward.InschrijvingenServiceReference.InschrijvingenServiceClient.OngetInschrijvingenCompleted(Object
    state)</p>
  </blockquote>
  
  <p>I'm not sure what's causing this, but the return value of 'i' I think is correct.</p>
  
  <p><img src="https://i.stack.imgur.com/A5mEy.png" alt="enter image description here"></p>
  
  <p>Thank you for taking your time to read this and help me, I greatly appreciate it!
  Thomas</p>