コレクション (T: INPC) 内のオブジェクトのプロパティが変更されるたびに CollectionChangedEvent を発生させる ObservableCollection<T> を作成しました。T のどのプロパティが CollectionChangedEvent を発生させたのか知りたいので、次のことを試しました。
void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, e));
}
PropertyChangedEventArgs e を NotifyCollectionChangedEventArgs のコンストラクターに渡します。
Intellisense に従って、2 番目のコンストラクターは、NotifyCollectionChangedAction と、「変更によって影響を受けた項目」として記述される「changedObject」と呼ばれるオブジェクトの 2 つのパラメーターを取ります。
CollectionChangedEventHandler でそのオブジェクトを取得して、PropertyName を確認できると思ったのですが、ああ! サプライズ!NotifyCollectionChangedEventArgs は「ChangedObject」プロパティを公開しません (Action、NewItems、OldItems、NewStartingIndex、OldStartingIndex を確認できます)。
これを達成する方法についてのアイデアはありますか?ところで、後でアクセスできないオブジェクトを使用して NotifyCollectionChangedEventArgs を構築する必要があるのは何ですか?