Skip to content

ObservableCollection<T>.Clear() does not raise propertychanged event? #1070

Closed Answered by maslewandowski
maslewandowski asked this question in Q&A
Discussion options

You must be logged in to vote

Solution:

ObservableCollection.Clear() does not raise propertychanged event.

If you want the popertychanged event to be raised, you need to
option 1:
create a new object and "overwrite" the existing variable value
var collection = new ObersvableCollection<IDrawingLine>();

option 2:
Call OnPropertyChanged manually
OnPropertyChanged(nameof(collection))

Just in case somebody is wondering.

greetings

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by maslewandowski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant