title: Silverlight 3 with RIA Services - Blank Result Sets/Load Finished
body: <p>I've been desperately trying for about the last week to figure out whatever my disconnect is that I can't wrap my head around RIA Services. I've meticulously followed the example shown in <a href="http://silverlight.net/learn/videos/all/net-ria-services-intro/" rel="nofollow noreferrer">the Microsoft tutorial video</a> and I'm still having problems. It may be that I'm trying to do something you can't, but in all likelihood I'm just going about it the wrong way.</p>
  
  <p>In the tutorial they use code very similar to:</p>
  
  <pre><code>IVCContext ctx = new IVCContext();
  MyDataGrid.ItemsSource = ctx.ChairOptions;
  ctx.Load(ctx.GetChairOptionsQuery());
  </code></pre>
  
  <p>Which populates the DataGrid with the information it finds in the ChairOptions table.</p>
  
  <p>But what I would like to do is have direct access to the results without having to bind them to a DataGrid, or any other control for that matter. I would like to simply get the result set, and then operate on it however I please.</p>
  
  <p>More specifically, I'd like to look at it's properties (name, cost, etc) and relations (group, sub-group) that are attached to it in the model so that I can perform special actions and alter the content of controls. But it seems like no matter what I try I get a blank result set.</p>
  
  <p>I've tried things like:</p>
  
  <pre><code>LocalContext ctx = new LocalContext();
  var ResultSet = ctx.ChairOptions;
  ctx.Load(ctx.GetChairOptionsQuery());
  </code></pre>
  
  <p>But ResultSet is always empty.</p>
  
  <p>I feel like part of the reason I can't figure this out is because I can't seem to find out exactly what's going on in the assignment on line #2, and what the Load() function is actually doing on line #3. In the first example it just works automagically, but I'd really like to understand what's going on.</p>
  
  <p>Thanks in advance for any help or references.</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>It just hit me this morning as I woke up what the problem might be. Although the code makes it looks very straightforward and procedural, the Load call is actually asynchronous, right? </p>
  
  <p>If that's correct, the question then becomes, how do I know when it's finished, so that I can operate on the results?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>More searching with this new insight led me to <a href="http://blogs.msdn.com/smccraw/archive/2009/07/15/a-net-ria-services-data-load-batch-manager.aspx" rel="nofollow noreferrer">this bit of information</a> about attaching callbacks to individual load operations. But the class provided in that link uses an object called LoadOperation, and although it appears that LoadOperation is in the System.Windows.Ria namespace, adding a using for it does not allow Visual Studio to recognize the references to LoadOperation as an object, so I can't build the project with this class in it.</p>