c# - datagrid binding not working for one datagrid but is for another -


i have datagrid (image below).

you see in row details there 3 other datagrids. bindings work 2 of them not 1 rather annoying.

the datagrid isn't working a) not showing value column sedol when should & b) doesn't allow me edit or click cells. object bound isn't null datagrid working bound same object. don't see why datagrid binding isn't working?

class holdingeq

please note have stripped out of code. class implements inotifypropertychanged interface , properties have

public class holdinglogeq : inotifypropertychanged     {                     public datetime dateeffective         {                         {                 return _dateeffective;             }             set             {                 _dateeffective = value;                 onpropertychanged("dateeffective");             }         }         public secruityid security         {                         {                 return _security;             }             set             {                 _security = value;                 onpropertychanged("security");             }         }         public double ratio         {                         {                 return _ratio;             }             set             {                 _ratio = value;                 onpropertychanged("ratio");                                 }         }                     public list<fundui> funds         {                         {                 return _funds;             }             set             {                 _funds = value;                 onpropertychanged("funds");             }         }         public holdinglogeq newhldlog         {                         {                 return _newhldlog;             }             set             {                 _newhldlog = value;                 onpropertychanged("newhldlog");             }         }          private datetime _dateeffective;         private secruityid _security = new secruityid();                     private double _ratio;         private list<fundui> _funds;         private holdinglogeq _newhldlog;          public event propertychangedeventhandler propertychanged;          void onpropertychanged(string propertyname)         {             if (propertychanged != null)                 propertychanged(this, new propertychangedeventargs(propertyname));         }      } 

class securityid

public class securityid : inotifypropertychanged     {                     public string isin         {                         {                 return _isin;             }             set             {                 _isin = value;                 onpropertychanged("isin");             }         }         public string sedol         {                         {                 return _sedol;             }             set             {                 _sedol = value;                 onpropertychanged("sedol");             }         }         public string bbergticker         {                         {                 return _bbergticker;             }             set             {                 _bbergticker = value;                 onpropertychanged("bbergticker");             }         }          public event propertychangedeventhandler propertychanged;          protected void onpropertychanged(string propertyname)         {             if (propertychanged != null)                 propertychanged(this, new propertychangedeventargs(propertyname));         }          private string _isin;         private string _sedol;         private string _bbergticker;     } 

datagrid that's not working - datagrid in top right of image

<datagrid grid.row="0"                               itemssource="{binding selecteditem.newhldlog,  relativesource={relativesource ancestortype={x:type datagrid}}, updatesourcetrigger=propertychanged}"                                                                                                 rowstyle="{staticresource dg_row}"                                 columnheaderstyle="{staticresource dg_columnheader}"                                rowheaderstyle="{staticresource dg_rowheadernested}"                               cellstyle="{staticresource dg_cell}"                                background="silver"                               horizontalgridlinesbrush="lightgray"                               verticalgridlinesbrush="lightgray"                               canuseraddrows="false"                               canuserdeleterows="false"                               margin="50,5,5,0"                               autogeneratecolumns="false">                                 <datagrid.columns>                                     <datagridtextcolumn header="isin" binding="{binding security.isin, mode=twoway, updatesourcetrigger=propertychanged}" isreadonly="false" minwidth="75"/>                                     <datagridtextcolumn header="sedol" binding="{binding security.sedol, mode=twoway, updatesourcetrigger=propertychanged}" isreadonly="false" minwidth="75"/>                                     <datagridtextcolumn header="ticker" binding="{binding security.ticker, mode=twoway, updatesourcetrigger=propertychanged}" isreadonly="false" minwidth="75"/>                                     <datagridtextcolumn header="name" binding="{binding security.name, mode=twoway, updatesourcetrigger=propertychanged}" isreadonly="false" minwidth="200"/>                                                                             </datagrid.columns>                             </datagrid> 

datagrid working

<datagrid grid.row="1" grid.column="0"  grid.columnspan="2"                               itemssource="{binding selecteditem.newhldlog.funds,  relativesource={relativesource ancestortype={x:type datagrid}}}"                                                                                                 rowstyle="{staticresource dg_row}"                                 columnheaderstyle="{staticresource dg_columnheader}"                                rowheaderstyle="{staticresource dg_rowheadernested}"                               cellstyle="{staticresource dg_cell}"                                background="silver"                               horizontalgridlinesbrush="lightgray"                               verticalgridlinesbrush="lightgray"                               canuseraddrows="false"                               canuserdeleterows="false"                               margin="50,5,5,20"                               autogeneratecolumns="false">                                 <datagrid.columns>                                     <datagridtextcolumn header="fund code" binding="{binding code}" isreadonly="true" minwidth="75"/>                                     <datagridtextcolumn header="fund code ss" binding="{binding codess}" isreadonly="true" minwidth="75"/>                                     <datagridtextcolumn header="nominal" binding="{binding changeinnominal}" isreadonly="false"/>                                 </datagrid.columns>                             </datagrid> 

image

example of datagrid

datagrids expect bound form of collection. in grid working can see bound list whereas other grid being bound single object.

try changing collection, or if meant 1 item perhaps consider alternative control display it?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -