Skip to content

It seems that add and remove cannot activate ObservableCollection to notify changes. How to solve this problem? #16334

Answered by maxkatz6
IronEaterBeast asked this question in Q&A
Discussion options

You must be logged in to vote

In my imagination, adding a new item should be the same as assigning and should enter the set method

It's not how it works. Normally "Property changed" event only is raised when any actual property is changed.
But since you implement your own ViewModelBase, that's up to you. Still - you wrote no code to call RaisePropertyChanged when collection items are changed. Setter won't be executed in this situation obviously.

if OneLineClass is another ViewModelBase like public class OneLineClass : ViewModelBase then AllContentOC.CollectionChanged will not work too.

AllContentOC.CollectionChanged still will work, when collection is changed.
But if you want to subscribe on property changes of th…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@IronEaterBeast
Comment options

@IronEaterBeast
Comment options

@maxkatz6
Comment options

Answer selected by IronEaterBeast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants