wpf - When is the PropertyChangedCallback fired -


i have trouble understanding problem occured me.

i have usercontrol structured somwhat this.

public class somepage : page {     public static readonly dependencyproperty somepropertyproperty =          dependencyproperty.register("someproperty", typeof(ipropertyvalue), typeof(somecontrol), new propertymetadata(null, new propertychangedcallback(onsomepropertychanged)));      private static void onsomepropertychanged(dependencyobject d, dependencypropertychangedeventargs e)     {         //do stuff     } } 

and viewmodel looks

public class someviewmodel : bindablebase {     private ipropertyvalue _prop;     public ipropertyvalue property     {                  {             if (_prop== null)                 _prop = new someconcretevalue();             return _prop;         }     } } 

and whole stuff bound page

<common:layoutawarepage>     <page.datacontext>         <vm:someviewmodel />     </page.datacontext>     <ctrl:somepage someproperty="{binding property}" /> </common:layoutawarepage> 

in understanding propertychangedcallbacked called whenever value of dependencyproperty changes.

allthough value of viewmodel.property never change, value of dependencyproperty "someproperty" still does, changes null inital bound value.

is there other possibility notified once property initialized or missing here?

edit: maybe not clear this. problem propertycahngedcallback not fired when initial value set someproperty.

i'm sorry did'nt @ log closely. problem was'nt event i'nt fired in fact binding i'nt possible. seems in windows 8 store apps dependencyproperties interface types don't work expected:

error: converter failed convert value of type '#namespace.concretepropertytype#, #application#, version=1.0.0.0, culture=neutral, publickeytoken=null' type 'ipropertyvalue'; bindingexpression: path='property' dataitem=''namespace.someviewmodel, #application#, version=1.0.0.0, culture=neutral, publickeytoken=null'; target element '#namespace.concretepropertytype#' (name='null'); target property '#concretepropertytype#' (type 'ipropertyvalue').  

source: http://social.msdn.microsoft.com/forums/en-us/winappswithcsharp/thread/5ec0a4ba-b80a-4a8a-8e5a-f2fe776c45b5/


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -