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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -