c# - WPF DataGrid shows no data -
this constructor of usercontrol includes datagrid element.
public results(list<cartitem> items) { initializecomponent(); this.items.datacontext = items; }
and xaml of datagrid.
<datagrid autogeneratecolumns="false" name="items" isreadonly="true" minheight="300"> <datagrid.columns> <datagridcheckboxcolumn> <datagridcheckboxcolumn.headertemplate> <datatemplate> <checkbox style="{staticresource stylecheckbox}" ischecked="{binding isselected}"/> </datatemplate> </datagridcheckboxcolumn.headertemplate> </datagridcheckboxcolumn> <datagridtextcolumn header="abone no" binding="{binding subscriberno}" /> <datagridtextcolumn header="adı soyadı" binding="{binding subscribername}" /> <datagridtextcolumn header="fatura tutarı" binding="{binding _amount, mode=oneway}" /> <datagridtextcolumn header="son Ödeme tarihi" binding="{binding _deadline, mode=oneway}" /> </datagrid.columns> </datagrid>
i double checked datacontext object of datagrid populated. no data being shown in datagrid. doing wrong?
you have set datacontext of grid. have set itemssource of datagrid this:
<datagrid itemssource="{binding}"
Comments
Post a Comment