Terminador
Terminador

Reputation: 1398

Get ObservableCollection<Object> as result of RIA Services under WPF Client to RIA Services

Is there some way to get ObservableCollection<Object> as result of RIA Services method under WPF Client to RIA Services?

Upvotes: 0

Views: 224

Answers (1)

Roberto Conte Rosito
Roberto Conte Rosito

Reputation: 2108

Simple, You can map your Ria Service Result as IEnumerable and after, init new ObservableCollection(riaOperationContractResult) when service response. This is an example:

MyService myService = new MyService();
myService.OnOperationContractExecuted += new EventHandler(OnOperationContractExecuted);
myService.BeginOperationContract(...);

...

private void OnOperationContractExecuted(object sender, OperationContractEventArgs e) {
    IEnumerable<MyServiceObj> objs = (IEnumerable<MyServiceObj>e.Result);
    ObservableCollection<MyServiceObj> obsObjs = new ObservableCollection<MyServiceObj>(objs);
}

...

Upvotes: 1

Related Questions