Buttons.Clear() does not work


<p>When I want to modify buttons observable collection bound from ViewModel I have to use Remove/Add methods. Clear method or to set a whole new collection (and rise property changed) does not work.</p>


Apjones wrote Oct 4, 2013 at 9:21 PM

If you have a collection you are bound to and only modifying, you can replace
while (Buttons.Count > 0) Buttons.RemoveAt(0);
(As description of issue says, but I thought it meant adding and removing from the bar directly at first, so stating this here incase anyone else makes the same error)

However I found difficulties when I was trying to change the actual bound collection. This caused the new items to be added but the old ones not removed (therefore I deem the same issue). I've avoided this now by restructuring my application to avoid this need.

billvo wrote Nov 14, 2013 at 2:56 PM

See issue Duplicates with INotifyPropertyChanged for resolution to problem original poster tried to work-around.