WPF XAML Datagrid XML File Binding with XElement, XML File Loaded in codebehind -


here go again kids, yet camper lost in woods around wpf databinding. been fruitful day of climbing databinding inverted ice wall, i'm @ wits end this. no examples find or amount of snoop'ing helping me find issue. databinding rock star, 3 of you, can brotha out! :)

xml file - faces , names have been changed protect innocent

    <?xml version="1.0" encoding="utf-8" ?> <mappings>   <mapping>     <class1>wonderbread</class1>     <class2>tortilla</class2>     <properties>       <property>         <jx>name</jx>         <dyn>name</dyn>         <create>1</create>         <update>0</update>       </property>       <property>         <jx>juice</jx>         <dyn>juice</dyn>         <create>1</create>         <update>0</update>       </property>       <property>         <jx>fred</jx>         <dyn>fred</dyn>         <create>1</create>         <update>0</update>       </property>       <property>         <jx>love</jx>         <dyn>love</dyn>         <create>1</create>         <update>0</update>       </property>     </properties>   </mapping> </mappings> 

how load xml file , set datagrids datacontext. done in constructor. loads correctly, via snoop can see xml file in datacontext.

    // load objectmappingxml file , set gridview context     xeclassmappings = xelement.load(configurationmanager.appsettings["classmappingxml"]);     dgmapping.datacontext = xeclassmappings; 

xaml code display content

        <datagrid x:name="dgmapping" itemssource="{binding path=elements[property]}" height="569">             <datagrid.columns >                 <datagridtextcolumn header="jxapi prop" binding="{binding path=element[jx].value}"/>                 <datagridtextcolumn header="dyn prop" binding="{binding path=element[dyn].value}"/>             </datagrid.columns>         </datagrid> 

what in name of holy missing? 8hrs of hopeful f5s has left me @ wits end...

you have reach properties element. change itemssource binding below:

<datagrid x:name="dgmapping" itemssource="{binding path=element[mapping].element[properties].elements[property]}" height="569"> 

it work.

hope helps


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -