ObservableCollection 和显示其数据问题,Windows Phone 7
我正在开发应用程序的一部分,我需要拍摄手机中的图像(用户使用应用程序下载它们)并将它们显示在数据绑定列表框中。让我们称之为Page1。
但是,我希望能够在用户“收藏”我的 RSS 源中的图像时添加到此集合中。让我们称这个页面为2。
所以本质上,我想将Page1项目和Page2项目结合起来,并将它们显示在Page1上。我还希望能够允许用户删除他们喜欢显示的任何图像。
我不确定该怎么做。我是否创建一个单独的类,并将所有项目写入独立存储中的文件中?
模拟代码(因为不在我的应用程序计算机上)
public class Imagelist : ObservableCollection<Images>
{
public Imagelist() : base()
{
//add items from page1.
//add items from page2.
Add(new Images("Imagepath"));
...
}
}
...获取/设置路径,也许通过将所有图像设置为一个键?
不确定,但绝对可以使用一些见解。
I am developing a part of my app where I need to take images I have in the phone (user downloads them with the application) and displaying them in a databound listbox. Let us call this Page1.
However, I want to be able to add to this collection when a user "favorites" an image from my RSS feed. Let us call this page 2.
So in essence, I want to combine Page1 items and Page2 items, and display them on Page1. I also want to be able to allow users to remove any of the images they like from being shown.
I am uncertain how to go about this. Do I create a separate class, and write all the items to a file in isolated storage?
mock code (since not on my app computer)
public class Imagelist : ObservableCollection<Images>
{
public Imagelist() : base()
{
//add items from page1.
//add items from page2.
Add(new Images("Imagepath"));
...
}
}
... get/set the pathing, maybe by setting all the images into a key?
Not sure, but definitely could use some insight.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 ImageList 作为单例实现应该可行。我创建了一个简短的示例,添加字符串而不是图像。
Implementing the ImageList as a singleton should work. I've created a short example that adds strings instead of images.