Return asynchronous data to Datagrid in Silverlight using MVVM

Posted by Saranram under Silverlight on 2/19/2013 | Points: 10 | Views : 2122 | Status : [Member] | Replies : 1
Hi All,

I am new bie to MVVM -Silverlight technology. I am using data grid to display details and used WCF (Async mode) service to retrieve the data. In the Model, I have used below code to retrieve the data from WCF service.
public void GetRecord(Action<IOperationResult> callback)
{
EmpDetails.BeginGetData(new AsyncCallback(EmpGetData_Callback), null);
}

private void EmpGetData_Callback(IAsyncResult result)
{
var results = EmpDetails.EndGetData(result);
}


Data grid binding mode is two way. Please let me know how to return data to DataGrid.

Saran


Responses

Posted by: Kundan64 on: 2/20/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Saranram,

in XAML write
AutoGenerateColumns="False"
for DataGrid
and in CS your method will be like:
private void EmpGetData_Callback(IAsyncResult result)

{
var results = EmpDetails.EndGetData(result);
DataGrid.ItemsSource = result;
}

I hope it will help you.

Saranram, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response