wpf - how to bind itemsource to combox which is in datagrid having again another itemsource -
this id code.. how bind itemsource combox in datagrid having again itemsource
<datagrid x:name="dgdata" autogeneratecolumns="false" borderbrush="aqua" minwidth="500" minheight="270" itemssource="{binding selectedaccdtlist}" background="transparent" canuseraddrows="true"> <datagrid.columns> <datagridtextcolumn header="sr.no." binding="{binding selectedaccdtlist.instcode}" /> <datagridcomboboxcolumn header="accessory_name" selectedvaluebinding="{binding selectedacclist, mode=twoway}" selectedvaluepath="itemcode" displaymemberpath="itemname" /> <datagridtextcolumn header="accessory_scope" binding="{binding accscop}"/> <datagridcomboboxcolumn header="accessory_type" itemssource="{binding accctyp}"> </datagridcomboboxcolumn> </datagrid.columns> </datagrid>
to want, need structure data correctly. means need have class data items , in class, need have 1 collection property:
<datagrid itemssource="{binding classitems}" autogeneratecolumns="false"> <datagrid.columns> <datagridtextcolumn binding="{binding stringpropertyfromclass}" header="sr.no." /> <datagridcomboboxcolumn itemssource="{binding collectionpropertyfromclass}" selecteditem="{binding dataitempropertyfromclass, mode=two-way}" header="items" /> ... </datagrid.columns> </datagrid>
Comments
Post a Comment