Silverlight: Populate Nested Datagrid when the parent datagrid row is selected
I am having problem loading data into Nested datagrid. When the user clicks on a row in parent datagrid, The id is retrieved and based on that the nested datagrid is loaded.
In the rowDetailsVisibilityChanged event.
DataGrid nestedDataGrid = e.DetailsElement as DataGrid;
SampleObj data= e.Row.DataContext as SampleObj ;
var client = new MyService.SampleServiceClient();
client.GetReportArchiveDataCompleted += GetSampleDataCompleted;
client.GetSampleDataAsync(data);
How can I add this line in Asyn completed event as I am not able to get the nested Datagrid in completed event.
IEnumerable dataL开发者_如何学运维ist= e.Result; nestedDataGrid.ItemSource = dataList
use an anonymous function instead....
client.GetReportArchiveDataCompleted +=
delegate(object sender1, GetReportArchiveDataCompletedArgs e1) {
nestedDataGrid.ItemSource=(IEnumerable)e1.Result;
};
Obviously change the delegate to the correct signature (same as your GetSampleDataCompleted.
精彩评论