.net - How can I know that the binding of a dependency property has changed? -


as mentioned in this question, there @ least 2 ways can notified value bound dependency property has changed:

  1. dependencypropertydescriptor.addvaluechanged
  2. dependencyproperty.overridemetadata on derived class own propertychangedcallback.

this working fine need notified when actual binding set on property not every time value changes. there way register callback or event need listen to?

i have looked in msdn on classes dependencyproperty, dependencyobject, bindingoperations , dependencypropertydescriptor.

i don't think there "official way" that, although had same problem days ago , came quite stupid @ least efficient workaround

private bool isset = false;  public static readonly dependencyproperty dummyproperty =             dependencyproperty.register("dummysource",                                         typeof(dummytype),                                         typeof(whateveryouwant),                                         new propertymetadata((s, a) =>                                         {                                           if (!isset)                                           {                                             //blah blah wanna                                              isset = true                                           }                                         })); 

works fine me, should trick :)


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -