c# - Are WPF Binding paths normalized under the hood? -


i wonder if makes difference, if repeat subpath property in each binding or if bind datacontext , state relative paths in bindings.

examples:

absolute paths:

<usercontrol x:name="uc"/>   <stackpanel>     <textbox text="{binding viewmodel.prop1, elementname=uc}" />     <textbox text="{binding viewmodel.prop2, elementname=uc}" />   </stackpanel> </usercontrol/> 

relative paths:

<usercontrol x:name="uc"/>   <stackpanel datacontext="{binding viewmodel, elementname=uc}">     <textbox text="{binding prop1}" />     <textbox text="{binding prop2}" />   </stackpanel> </usercontrol/> 

i know both bind same properties, i'm interested in what's happening behind scenes, because maybe can influence performance in situations there more 2 bindings. variant absolute paths result in more "event traffic", because each of text-bindings observes viewmodel-property , specific property? or same? imagine bindingmanager resolving binding paths, s.th. both variants end in same il.

if structure of binding hierarchy have influence: there positive effect (beside code style preferences) of using 'slower' approach full paths in each binding?

once binding object instantiated, doesn't matter how elaborate markup created it; object contains reference source property, , how reference found no longer relevant. performance impact of doing 1 way on other going when binding instantiated.

not not repeating going perform (imperceptibly) better, it's right way it. dry principle applicable xaml other kind of software development.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -