Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

wpf - what is notifycollectionchangedaction reset value -


i have observable collection...selectabledatacontext<t>..and in generic class selectabledatacontext<t> is...having 2 private member variables

  1. private t item.
  2. private bool isselected.

when isselected property changes...my collection's changed property not firing .

i think should fire...because it's reset in inotifycollectionchangedaction.

this old question benefit of may come across through search did:

notifycollectionchangedaction.reset means "the content of collection changed dramatically". 1 case reset event raised when call clear() on underlying observable collection.

with reset event, don't newitems , olditems collections in notifycollectionchangedeventargs parameter.

this means you're better off using "sender" of event reference modified collection , use directly, i.e. assume it's new list.

an example of might like:

((inotifycollectionchanged)stringcollection).collectionchanged += new notifycollectionchangedeventhandler(stringcollection_collectionchanged);   ...  void stringcollection_collectionchanged(object sender, notifycollectionchangedeventargs e) {     switch (e.action)     {         case notifycollectionchangedaction.add:             foreach (string s in e.newitems)             {                 internaladd(s);             }             break;          case notifycollectionchangedaction.remove:             foreach (string s in e.olditems)             {                 internalremove(s);             }             break;          case notifycollectionchangedaction.reset:             readonlyobservablecollection<string> col = sender readonlyobservablecollection<string>;             internalclearall();             if (col != null)             {                 foreach (string s in col)                 {                     internaladd(s);                 }             }             break;     } } 

lots of discussions on reset event here: when clearing observablecollection, there no items in e.olditems.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -