locked
LoadAsync doesn't return data RRS feed

  • Question

  • I'm doing my first Silverlight App with Data Services - I'm struggling to get my data into my app. I'm pretty sure the data is being returned because if I paste the URL in the browser I get the data I expect. It when I go to access the data in the LoadComplete event there's nothing in the object. This code is in a Silverlight Class Library and I will be using MVVM. What is the best way of notifying the View from the model in an Async situation. I'm guessing having everything as properties and using NotifyPropertyChanged? Any pointers would be great as I'm new to this. Cheers.

     

    public void GetBySupplierID(int

    SupplierID)

    {

     

    var ctx = new CollectiveDevEntities(new Uri(http://123.123.123.123/data.svc

    ));

     

    var qry = from d in

    ctx.Supplier_Addresses_Grouped

     

    where d.SupplierID == SupplierID select

    d;

     

    var col = new DataServiceCollection<Supplier_Addresses_Grouped

    >(ctx);

    col.LoadCompleted +=

    new EventHandler<LoadCompletedEventArgs

    >(GetBySupplierID_LoadCompleted);

    col.LoadAsync(qry);

    }

     

    private void GetBySupplierID_LoadCompleted(object

    sender,

     

    LoadCompletedEventArgs

    e)

    {

     

    var binding = (DataServiceCollection<Supplier_Addresses_Grouped

    >)sender;

     

    var

    i = 0;

    }

    Monday, April 11, 2011 5:53 PM