wpf - Xaml - combo box - why does selectedValue NOT work with multiple columns? -


hi , help.

the following xaml works fine:

<combobox name="cbocit_type"   issynchronizedwithcurrentitem="true"       mvvm:view.flowswithprevious="true"   itemssource="{binding path=cucodeinfo.cittypes}"   selectedvaluepath="code"    displaymemberpath="code"    text="{binding cit_type}"   iseditable="true"   isreadonly="false"   selectedvalue="{binding path=cit_type}"> </combobox> 

cucodeinfo.cittypes list of items available. there number of public properties, 2 in question "code" , "description".

right now, show available code values , user selects one. if 1 selected, shows when page displayed. good.

so thought might nice show both code , description. figured shouldn't hard...

so removed displaymemberpath statement , added in itemtemplate.

when did looked great until tried select item list. when did so, instead of showing selected code, empty string. have searched internet trying find 1 thing need add datatemplate fix this, have tried has failed. here code not working:

<combobox name="cbocit_type"   issynchronizedwithcurrentitem="true"       mvvm:view.flowswithprevious="true"   itemssource="{binding path=cucodeinfo.citationtypes}"   selectedvaluepath="code"    text="{binding cit_type}"   iseditable="true"   isreadonly="false"   selectedvalue="{binding cit_type}">    <combobox.itemtemplate>     <datatemplate>         <stackpanel orientation="horizontal" >             <border borderthickness="0,0,1,0" borderbrush="black">                 <textblock text="{binding path=code}" mvvm:view.widthex="2" ></textblock>             </border>             <textblock text="{binding path=description}" mvvm:view.widthex="15" margin="1" ></textblock>         </stackpanel>     </datatemplate>   </combobox.itemtemplate> </combobox> 

any appreciated.

as aside, have use exact same format (same list, etc. different selectedvalue) in number of forms - if want suggest best way in xaml, nice. in pre-xaml days, create control, set property or 2, , use in forms. supposed use xaml, not sure of best way this.

thanks!

i can't believe searched on net find answer and, until now, not find one. answer easy thought should be.

just replace: displaymemberpath="code" textsearch.textpath="code" , code works fine.

thanks helped.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -