Binding Collection

2 posts, 0 answers
  1. Kristjan Einarsson
    Kristjan Einarsson avatar
    95 posts
    Member since:
    Jan 2010

    Posted 27 Aug 2010 Link to this post

    I'm having some binding troubles and was wondering if you could help me out.
    if ie:
    sudo code
    class Product
     prop parentid
     prop Name
     prop Color
     prop List<PricePerMonth>
     prop List<PricePerMonthHeader>
     prop List<Prouct> Children
      
    class PricePerMonth
     prop Price

    classPricePerMonthHeader
     prop Header

    and the result would something like this:
    Name | Color | Month 1 | Month 2 | Month 3... etc.
    car x       blue        300          200               22    ....
         > some children
    car z     red          10             22                 33
         > some children

    Is there any good way to achieve this ?

    Regards
    Kristján.
  2. Kristjan Einarsson
    Kristjan Einarsson avatar
    95 posts
    Member since:
    Jan 2010

    Posted 01 Sep 2010 Link to this post

    Well found out.
    By using

    for (int i = 0; i < datasource.Values.Count(); i++)
     {
         GridViewDataColumn col = new GridViewDataColumn();
         Binding b = new Binding("Values[" + i + "].value")
         { Mode = BindingMode.TwoWay };
         col.DataMemberBinding = b;
         radTreeListView.Columns.Add(col);
    }
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top