观察的集合替换项目 [英] Observable Collection replace item

查看:183
本文介绍了观察的集合替换项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的ObservableCollection ,我可以添加和删除集合中的项目。但我不能集合中替换现有项目。有一种方法来取代一个项目,反映了我的绑定组件。

  System.Collections.Specialized.NotifyCollectionChangedAction.Replace

任何人都可以请告诉我如何做到这一点?


解决方案

 集合[someIndex] =的newitem;

I have a ObservableCollection, I can add and remove item from the collection. But I can't replace an existing item in the collection. There is a way to replace an item and reflect that on my bound components.

System.Collections.Specialized.NotifyCollectionChangedAction.Replace

Can anyone please show me how to accomplish this?

解决方案

collection[someIndex] = newItem;

这篇关于观察的集合替换项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆