繁体   English   中英

获取ObservableCollection <Object> WPF客户下的RIA服务转RIA服务的结果

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

WPF客户端下,是否有某种方法可以将ObservableCollection<Object>作为RIA Services方法的结果获取到RIA Services

很简单,您可以将Ria服务结果映射为IEnumerable,然后在服务响应时初始化新的ObservableCollection(riaOperationContractResult)。 这是一个例子:

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);
}

...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM