c# - Binding in property node -


i'm trying binding this

<local:tempusercontrol>     <local:tempusercontrol.foo>         <local:foo name2="{binding path=name, relativesource={relativesource ancestortype={x:type local:tempusercontrol}}}"/>     </local:tempusercontrol.foo> </local:tempusercontrol> 

and getting error

cannot find source binding reference 'relativesource findancestor, ancestortype='wpfapplication1.tempusercontrol', ancestorlevel='1''. bindingexpression:path=name; dataitem=null; target element 'foo' (name=''); target property 'name2' (type 'string')

any idea please wrong?

for work, foo object needs logical child of tempusercontrol. frameworkelement (and frameworkcontentelement) provides 2 methods this: addlogicalchild , removelogicalchild.

so, in tempusercontrol, register property-changed callback foo dependency property. callback can pass old , new value instance method, calls removelogicalchild old value , addlogicalchild new value. note foo must inherit either frameworkelement or frameworkcontentelement, otherwise won't included in logical tree.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -