问题描述
你好,
我正在努力将一些来自WinRT组件的数据呈现给一个JS商店应用程序,并努力做一些我认为应该简单的事情!
我的数据服务具有以下方法签名:
public IEnumerable< SurveyViewModel> GetSurveys(){}
当我从JS调用它时,我正在努力找出将内容绑定到listview的最佳方法。我认为最好直接绑定结果,或迭代内容并将每个项目'push()'发送到我的公共WinJS.Binding.List()。
什么是推荐的方法来解决这个问题?我假设我需要将IEnumerable转换为类似客户端的数组。
有什么想法吗?非常感谢,
Doug
Hi there,
I'm working on presenting some data from a WinRT component to a JS store app and struggling on something I think should be simple!
My data service has the following method signature:
public IEnumerable<SurveyViewModel> GetSurveys() {}
When I call this from JS I'm struggling to work out the best way to bind the contents to my listview. I thought it best to either directly bind the result, or to iterate over the contents and 'push()' each item onto my public WinJS.Binding.List().
What is the recommended way to approach this? I'm presuming I need to translate the IEnumerable into something array like on the client side.
Any thoughts? Many thanks,
Doug
这篇关于迭代运行时组件的IEnumerable结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!