c# - Not able to refresh WPF Combobox inside datagrid -
i new in wpf , need bind combobox inside datagrid based on button click outside datagrid. means every time when click on button combobox inside datagrid should refresh.
i able bind source column combobox not getting refreshed when click on apply button changing source file shown in above image.
xaml code did is
<grid name="grdmappedtables" margin="0,109,466,28" background="lightgray"> <grid.resources> <objectdataprovider x:key="sourcedataprovider" objecttype="{x:type local:sourcetable}" methodname="fillsourcetablecol" ></objectdataprovider> </grid.resources> <datagrid name="dgmappedtables" renderoptions.cleartypehint="enabled" textoptions.textformattingmode="display" canuseraddrows="false" selectionunit="fullrow" style="{dynamicresource azuredatagrid}" gridlinesvisibility="all" autogeneratecolumns="false" borderbrush="black" borderthickness="1"> <datagrid.columns> <datagridtextcolumn width="25" isreadonly="true" canuserresize="false" > </datagridtextcolumn> <datagridcomboboxcolumn header="source" width="200" canuserresize="false" selectedvaluebinding="{binding path=column_id}" selectedvaluepath="column_id" displaymemberpath="column_name" itemssource="{binding source={staticresource sourcedataprovider}}"> <datagridcomboboxcolumn.editingelementstyle> <style targettype="combobox"> <setter property="iseditable" value="false"></setter> </style> </datagridcomboboxcolumn.editingelementstyle> </datagridcomboboxcolumn> <datagridcomboboxcolumn header="target" width="200" canuserresize="false" > </datagridcomboboxcolumn> </datagrid.columns> </datagrid> </grid>
code behind class used is
public class sourcetable { public dataview fillsourcetablecol() { datatable dtsourcetable = new datatable(); dtsourcetable = commondbclass.gettable("select column_id, column_name systabcol", strconnectionstring); return dtsourcetable.defaultview; } }
how should refresh combobox when click on apply button?
Comments
Post a Comment