简体   繁体   中英

Editing observable collection via property grid

I have a class with observable collection property and I edit this property with PropertyGrid. When I remove some items from it and press OK button my collection starting to fire CollectionChanged events, but it doesn't fire event with Remove Action. Firstly it fires event with Reset action and then it fires events with Add action of remain items.

How can I get when collection fires last CollectionChanged event?

How can I get which items was removed?

Well, I did a pretty weird solution, but it worked for me, mb it gonna help someone later. It has some obviously evil sides, but for now it is still better than nothing.

Everytime when CollectionChanged fired I start my local timer with, for example, 500ms interval, if timer is elapsed - last collection changed event already triggered.

Also I have a local copy of unique IDs of items in my observable collection, so after timer elapsing I can check which items was removed from collection, so i can clean data which was binded on it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM