c# - FreezableCollection not providing change notification when sub properties change -


i have freezablecollection want monitor changes sub properties. here subsection of code:

public class fieldheading : dependencyobject {     public static readonly dependencyproperty layoutproperty = dependencyproperty.register("layout", typeof(fieldheadinglayout), typeof(fieldheading),         new frameworkpropertymetadata(fieldheadinglayout.above,         frameworkpropertymetadataoptions.affectsrender |         frameworkpropertymetadataoptions.affectsmeasure |         frameworkpropertymetadataoptions.affectsparentmeasure));      public fieldheadinglayout layout     {         { return (fieldheadinglayout) getvalue(layoutproperty); }         set { setvalue(layoutproperty, value); }     }  }  public class fieldpanel : frameworkelement {     private static readonly dependencyproperty fieldheadingproperty = dependencyproperty.register("fieldheading", typeof(freezablecollection<fieldheading>), typeof(fieldpanel),         new frameworkpropertymetadata(null,             frameworkpropertymetadataoptions.affectsmeasure |             frameworkpropertymetadataoptions.affectsparentmeasure |             frameworkpropertymetadataoptions.affectsrender, headingchanged));      private static void headingchanged(dependencyobject d, dependencypropertychangedeventargs e)     {         debug.writeline("hello");     }      public freezablecollection<fieldheading> fieldheadings     {                 { return (freezablecollection<fieldheading>) getvalue(fieldheadingproperty); }         set { setvalue(fieldheadingproperty, value);}     }      public fieldpanel()     {         addvisual(_contentvisual = new drawingvisual());         fieldheadings = new freezablecollection<fieldheading>();     } } 

then assign new value layout 1 of fieldheadings, no change notification generated. i'm missing important. headingchanged never called.

the msdn on freezablecollection, can found here: freezablecollection, states:

event changed... occurs when freezable or object contains modified. (inherited freezable.)

thanks in advance help.

~ cameron

the change notification handler notify when value of property changes, in case if freezable collection changes new collection. in property changed handler need subscribe collectionchanged event , in event need subscribe propertychanged event on new item. now, finally, have event allow react changes in properties of items belonging freezable collection dependency property. remember unsubscribe old collection's , old item's events.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -