c# - (Solved) DataGrid binding on a List in an Object -


i'm trying bind class schedulep on datagrid in wpf application. inside class there's class every day of week, inside list. have 7 columns, , i'm trying bind data of list inside these columns

i tried setting {binding day[0].name} not display anything... displaying time string.

any ideas?

thanks in advance.

    //cs     public class schedulep     {         public string time { get; set; }         public list<_day> day = new list<_day>();         public class _day         {             public string name;             public string subject;             public bool lab;         }      }     public main()     {         initializecomponent();         schedulep sch = new schedulep();         sch.day.add(new schedulep._day() { name = "asd", subject = "asd", lab = true });         sch.time = "ads";         list<schedulep> users = new list<schedulep>();         users.add(sch);         programmgrid.itemssource = users;      }    //xaml    <datagridtextcolumn binding="{binding time}" canusersort="false" canuserreorder="false" canuserresize="false" clipboardcontentbinding="{x:null}" width="60"/>    <datagridtextcolumn binding="{binding day[0].name}" header="Δευτέρα" canusersort="false" canuserreorder="false" canuserresize="false" isreadonly="true" width="*"/> 

edit found out solution

    public class schedulep     {         public string time { get; set; }         public list<_day> day { get; set; }         public class _day         {             public string name { get; set; }             public string subject { get; set; }             public bool lab { get; set; }         }      } 

that way go. help


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -