i have datagrid 3 columns.
<datagrid iemsource={binding somedata}> <datagrid.columns> <datagridtemplatecolumn> </datagridtemplatecolumn> <datagridtemplatecolumn> </datagridtemplatecolumn> <datagridtemplatecolumn> <datagridtemplatecolumn.headertemplate> <datatemplate> <itemscontrol itemsource="{binding somelist}"> <stackpanel orientation="horizontal"> <textblock text="sometopic"/> <combobox itemsource="{binding }"/> </stackpanel> </itemscontrol> </datatemplate> </datagridtemplatecolumn.headertemplate> <datagridtemplatecolumn.celltemplate> <datatemplate> <combobox /> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> </datagrid.columns>
somedata object collection of classa. class contains 2 string fields , have binded them first 2 columns.
the class contains list of string variables of name somelist. have binded 3rd column. need attach combobox in header of column 3. code not give me want.
can ?
your problem seems add stackpanel item itemscontrol instead of using in datatemplate.
instead of
<itemscontrol itemsource="{binding somelist}"> <stackpanel orientation="horizontal"> <textblock text="sometopic"/> <combobox itemsource="{binding }"/> </stackpanel> </itemscontrol>
it should this:
<itemscontrol itemsource="{binding somelist}"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <textblock text="sometopic"/> <combobox itemsource="{binding }"/> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol>
Comments
Post a Comment