wpf - How do I bind combobox text to legacy data not in the drop down list? -



wpf - How do I bind combobox text to legacy data not in the drop down list? -

the drop-down list (itemssource) of combobox contains new product request items. i want bind legacy info not in drop-down list. complicate things i'm using multibinding imultivalueconverter combine fields display. also, names of bound fields not match names of properties i'm bound to.

the combobox itemssource list of newproductrequests. npr object newprodnumber , newprodname combined display in drop-down list type converter. convertback method returns values newprodnumber , newprodnumbercombinedwithname. these 2 values saved database fields different names. illustration i'll phone call them dbprodrequestnumber , dbprodrequesttitle.

i've succeeded in displaying , saving new items. the problem haven't figured out how display legacy info not in list. it's not in list because no longer qualifies new product request.

here problem xaml (the itemssource set in code-behind):

<combobox x:name="nprcombobox" issynchronizedwithcurrentitem="false" iseditable="false"> <combobox.selecteditem> <multibinding converter="{staticresource combinenprstuffmulticonverter}"> <binding path="dbprodrequestnumber" updatesourcetrigger="propertychanged"/> <binding path="dbprodrequesttitle" updatesourcetrigger="propertychanged"/> </multibinding> </combobox.selecteditem> <combobox.itemtemplate> <datatemplate> <textblock datacontext="{binding}"> <textblock.text> <multibinding converter="{staticresource combinenprstuffmulticonverter}"> <binding path="newprodnumber" updatesourcetrigger="propertychanged"/> <binding path="newprodnumbercombinedwithname" updatesourcetrigger="propertychanged"/> </multibinding> </textblock.text> </textblock> </datatemplate> </combobox.itemtemplate> </combobox>

a similar problem datagrid , combobox solved using datagridtemplatecolumn.celleditingtemplate based on this msdn mag example julie lerman. of course, in case i'm not using datagrid.

thanks in advance help.

this reply (to own question) pulled comment in nathanaw answer:

unfortunately can't include legacy items in itemssource. list web service out of control. devised kludgy solution don't (but works)...since know combobox needed new records visible when user clicks "add". in same location placed textbox bound legacy info visible when not in add together mode. so, toggle visiblity of each command app switches in , out of add together mode. i'm sure there improve way!

wpf combobox binding multibinding

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -