i'm working in wpf
mvvm
application in have scenario need clear list binded 2 way radgrid
(i.e) have show grid empty on click of button.
i tried using ,
seriessearchlist.clear();
//does not work.
seriessearchlist = null;
// works.
i have declared in way,
private list<seriessearchbo> m_lsearchlist; public list<string> seriessearchlist { { return this.m_lsearchlist; } set { if (this.m_lsearchlist!= value) { this.m_lsearchlist= value; onpropertychanged(); } } }
just curious why not able have list.clear()
working 2 way binding.
in first case, removing elements list, not assign new value (old reference) in second case assigning new value list method onpropertychanged invoked.
you can solve problem in 2 ways:
- use observablecollection instead of list said @general-doomer
- seriessearchlist.clear(); onpropertychanged("seriessearchlist");
Comments
Post a Comment