wpf - Image Control Source property binding in PowerShel -


i've wpf image control, want set source dynamically through custom property added treeviewitem. here piece of code of image control:

<treeview name="tvicomp" >     <treeview.resources>             <style targettype="{x:type treeviewitem}">                 <setter property="headertemplate">                     <setter.value>                         <datatemplate datatype="contentpresenter">                             <grid>                                 <stackpanel name="spimg" orientation="horizontal">                                     <image  name="imgnoderoot"                                             width="20"                                             height="20"                                             stretch="fill"                                             source="{binding relativesource={relativesource mode=findancestor, ancestortype={x:type treeviewitem}},path=(nodeicon)}"                                             verticalalignment="center"                                             horizontalalignment="left"                                             grid.column="1"                                     /> 

here powershell code create , add new property :

$tk_tviitem=new-object -typename system.windows.controls.treeviewitem $tk_tviitem.header="computer" $tk_tviitem.tag="c:\temp\folder.png" add-member -inputobject $tk_tviitem -membertype noteproperty -name "nodeicon" -value "c:\temp\folder.png" 

in wpf binding, if use binding path=(tag) bind tag property treeview's own, image shown. if use binding path=(nodeicon) bind custom property added using add-member, image not shown. got idea why binding own property works doesn't work on custom added property ?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -