silverlight - "BindingExpression path error" using ItemsControl and VirtualizingStackPanel -


i'm using silverlight on windows phone 7.

is normal loads of "bindingexpression path error" debug messages when using virtualizingstackpanel? think happening because visual items temporarily unbound data items collection recycled ...

i have itemscontrol itemspanel's itemspaneltemplate virtualizingstackpanel. binds "notes" observablecollection on viewmodel.

<itemscontrol x:name="listview" itemssource="{binding notes}"                itemtemplate="{staticresource listdatatemplate}">     <itemscontrol.itemspanel>         <itemspaneltemplate>             <virtualizingstackpanel/>         </itemspaneltemplate>     </itemscontrol.itemspanel>     <itemscontrol.template>         <controltemplate>             <scrollviewer x:name="scrollviewer" padding="{templatebinding padding}">                 <itemspresenter/>             </scrollviewer>         </controltemplate>     </itemscontrol.template> </itemscontrol> 

this within usercontrol datacontext set mainviewmodel viewmodel.

the listdatatemplate contains button, contains text, data-bound property of items in notes observablecollection:

<datatemplate x:key="listdatatemplate">         <button>         <grid>             <textblock textwrapping="wrap" text="{binding title}">         </grid>     </button> </datatemplate> 

when run program works fine - small number of items in notes collection bound @ 1 time. lots of debug errors scroll , down:

system.windows.data error: bindingexpression path error: 'title' property not found on 'enwp7.viewmodels.mainviewmodel' 'enwp7.viewmodels.mainviewmodel' (hashcode=119211466). bindingexpression: path='title' dataitem='enwp7.viewmodels.mainviewmodel' (hashcode=119211466); target element 'system.windows.controls.textblock' (name=''); target property 'text' (type 'system.string').. system.windows.data error: bindingexpression path error: 'title' property not found on 'enwp7.viewmodels.mainviewmodel' 'enwp7.viewmodels.mainviewmodel' (hashcode=119211466). bindingexpression: path='title' dataitem='enwp7.viewmodels.mainviewmodel' (hashcode=119211466); target element 'system.windows.controls.textblock' (name=''); target property 'text' (type 'system.string').. system.windows.data error: bindingexpression path error: 'title' property not found on 'enwp7.viewmodels.mainviewmodel' 'enwp7.viewmodels.mainviewmodel' (hashcode=119211466). bindingexpression: path='title' dataitem='enwp7.viewmodels.mainviewmodel' (hashcode=119211466); target element 'system.windows.controls.textblock' (name=''); target property 'text' (type 'system.string').. system.windows.data error: bindingexpression path error: 'title' property not found on 'enwp7.viewmodels.mainviewmodel' 'enwp7.viewmodels.mainviewmodel' (hashcode=119211466). bindingexpression: path='title' dataitem='enwp7.viewmodels.mainviewmodel' (hashcode=119211466); target element 'system.windows.controls.textblock' (name=''); target property 'text' (type 'system.string').. 

it looking "title" property on main view model (whose notes property itemssource) - think normal - transient situation visual items unbound items in notes collection in order recycled assigning them item in collection.

has else seen this? right normal?

if create dummy title property on mainviewmodel , set debug breakpoint see stack trace. note "unlinkcontainerfromitem":

...!enwp7.viewmodels.mainviewmodel.title.get() line 54  c# mscorlib.dll!system.reflection.runtimemethodinfo.internalinvoke(system.reflection.runtimemethodinfo rtmi = {system.reflection.runtimemethodinfo}, object obj = {enwp7.viewmodels.mainviewmodel}, system.reflection.bindingflags invokeattr = default, system.reflection.binder binder = null, object parameters = null, system.globalization.cultureinfo culture = null, bool isbinderdefault = false, system.reflection.assembly caller = null, bool verifyaccess = true, ref system.threading.stackcrawlmark stackmark = lookformycaller)  mscorlib.dll!system.reflection.runtimemethodinfo.internalinvoke(object obj = {enwp7.viewmodels.mainviewmodel}, system.reflection.bindingflags invokeattr = default, system.reflection.binder binder = null, object[] parameters = null, system.globalization.cultureinfo culture = null, ref system.threading.stackcrawlmark stackmark = lookformycaller) + 0x14e bytes  mscorlib.dll!system.reflection.runtimepropertyinfo.internalgetvalue(system.reflection.propertyinfo thisproperty = {system.reflection.runtimepropertyinfo}, object obj = {enwp7.viewmodels.mainviewmodel}, object[] index = null, ref system.threading.stackcrawlmark stackmark = lookformycaller) + 0x4e bytes   mscorlib.dll!system.reflection.runtimepropertyinfo.getvalue(object obj = {enwp7.viewmodels.mainviewmodel}, object[] index = null) + 0x2 bytes    system.windows.dll!system.windows.clrpropertylistener.value.get() + 0x1b bytes   system.windows.dll!system.windows.propertyaccesspathstep.connecttopropertyinsource() + 0x148 bytes   system.windows.dll!system.windows.propertyaccesspathstep.connecttoproperty() + 0x16 bytes    system.windows.dll!system.windows.propertyaccesspathstep.reconnect(object newsource = {enwp7.viewmodels.mainviewmodel}) + 0x13 bytes     system.windows.dll!system.windows.propertypathlistener.reconnect(object source = {enwp7.viewmodels.mainviewmodel}) + 0x10 bytes  system.windows.dll!system.windows.data.bindingexpression.sourceaquired() + 0x11 bytes    system.windows.dll!system.windows.data.bindingexpression.datacontextchanged(object o = {system.windows.controls.textblock}, system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x26 bytes    system.windows.dll!system.windows.frameworkelement.ondatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x15 bytes    system.windows.dll!system.windows.frameworkelement.onancestordatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x11 bytes    system.windows.dll!system.windows.frameworkelement.notifydatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x59 bytes    system.windows.dll!system.windows.frameworkelement.onancestordatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x18 bytes    system.windows.dll!system.windows.frameworkelement.notifydatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x59 bytes    system.windows.dll!system.windows.frameworkelement.onancestordatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x18 bytes    system.windows.dll!system.windows.frameworkelement.notifydatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x59 bytes    system.windows.dll!system.windows.frameworkelement.onancestordatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x18 bytes    system.windows.dll!system.windows.frameworkelement.notifydatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x59 bytes    system.windows.dll!system.windows.frameworkelement.onancestordatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x18 bytes    system.windows.dll!system.windows.frameworkelement.notifydatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x59 bytes    system.windows.dll!system.windows.frameworkelement.onancestordatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x18 bytes    system.windows.dll!system.windows.frameworkelement.notifydatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x59 bytes    system.windows.dll!system.windows.frameworkelement.onancestordatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x18 bytes    system.windows.dll!system.windows.frameworkelement.notifydatacontextchanged(system.windows.datacontextchangedeventargs e = {system.windows.datacontextchangedeventargs}) + 0x59 bytes    system.windows.dll!system.windows.frameworkelement.onpropertychanged(system.windows.dependencyproperty dp = {system.windows.coredependencyproperty}) + 0x1d bytes    system.windows.dll!system.windows.dependencyobject.raisepropertychangenotifications(system.windows.dependencyproperty dp = {system.windows.coredependencyproperty}, object newvalue = {enwp7.viewmodels.mainviewmodel}, object oldvalue = {enwp7.store.notelocal}) + 0x38 bytes  system.windows.dll!system.windows.dependencyobject.clearvalueinternal(system.windows.dependencyproperty dp = {system.windows.coredependencyproperty}) + 0x138 bytes  system.windows.dll!system.windows.dependencyobject.clearvalue(system.windows.dependencyproperty dp = {system.windows.coredependencyproperty}) + 0x7 bytes    system.windows.dll!system.windows.controls.itemcontainergenerator.unlinkcontainerfromitem(system.windows.dependencyobject container = {system.windows.controls.contentpresenter}, object item = {enwp7.store.notelocal}, bool isrecycling = true) + 0x1f bytes   system.windows.dll!system.windows.controls.itemcontainergenerator.remove(system.windows.controls.primitives.generatorposition position = {system.windows.controls.primitives.generatorposition}, int count = 2, bool isrecycling = true) + 0x14a bytes   system.windows.dll!system.windows.controls.itemcontainergenerator.system.windows.controls.primitives.irecyclingitemcontainergenerator.recycle(system.windows.controls.primitives.generatorposition position = {system.windows.controls.primitives.generatorposition}, int count = 2) + 0x9 bytes     system.windows.dll!system.windows.controls.virtualizingstackpanel.cleanuprange(int startindex = 0, int count = 2) + 0x20 bytes   system.windows.dll!system.windows.controls.virtualizingstackpanel.cleanupcontainers(system.windows.controls.itemscontrol itemscontrol = {system.windows.controls.itemscontrol}) + 0x73 bytes     system.windows.dll!system.windows.controls.virtualizingstackpanel.measureoverride(system.windows.size constraint = {system.windows.size}) + 0xe4 bytes   system.windows.dll!system.windows.frameworkelement.measureoverride(system.intptr nativetarget = 102509504, float inwidth = 480.0, float inheight = 499.0, out float outwidth = 0.0, out float outheight = 0.0) + 0x45 bytes  

thanks, damian

i think assessment of situation correct, sounds bug in way virtualizingstackpanel works. it's not affecting execution or bindings of application @ points need it, raising exceptions relatively expensive operation , make sense update appropriate datacontext accordingly when unlinking containers.

i think best place raise potential bug on app hub forums


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -