源代码视图模型是在这里: https://github.com/djangojazz/BubbleUpExample更新时可观察集合中的项目进行更新
的问题是我想要一个视图模型的一个ObservableCollection调用更新,当我更新项目的属性那个集合。我可以更新绑定的数据,但保存集合的ViewModel不会更新,UI也不会更新。
public int Amount
{
get { return _amount; }
set
{
_amount = value;
if (FakeRepo.Instance != null)
{
//The repo updates just fine, I need to somehow bubble this up to the
//collection's source that an item changed on it and do the updates there.
FakeRepo.Instance.UpdateTotals();
OnPropertyChanged("Trans");
}
OnPropertyChanged(nameof(Amount));
}
}
基本上,我需要的成员告诉何地它被称为集合:“嘿,我更新了你,采取通知,告诉你的一部分父我只是无知冒泡例程或调用为了达到这个目的,我发现有限的线程与我所做的略有不同,我知道它可以做很多事情,但我没有运气。下面的图片不需要先点击列。
搜索类似trulyObservableCollection的
AddToTrans
方法,这里是一个samle:https://stackoverflow.com/questions/1427471/observablecollection-not-noticing-when-item在它改变,甚至与inotifyprop – sTrenat