In my previous blog post I have demonstrated how to display master-details data in an asynchronous manner with RadGridView for Silverlight and WCF RIA Services. I have decided to refactor the sample project a little bit and add some very basic editing support. Here is the changes I have made to the sample project:
Here is what the new AlbumsControl looks like:
Instead of creating the DomainDataSource in the converter like in the previous version, now the AlbumsControl hosts its own little albums DomainDataSource. Notice how the ControlParameter tells the DomainDataSource what is the artistId it should use when executing the “GetAlbumsForArtistId” query. Since the AlbumsControl is inside row details, the DataContext of the albumsGrid automatically becomes the master data item, in our case the Artist. And since DataContext is an instance of the Artist entity, I have assigned “DataContext.ArtistId” as the PropertyName of the ControlParameter.
Finally, here is what it takes to commit your changes:
Hiding the details grid and all of its logic into its own user control cleaned up the MainPage considerably:
See the editing in action:
Download the source code of the updated demo project from here.