This is a migrated thread and some comments may be shown as answers.

Databinding to Columns Collection of Collections

2 Answers 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 20 Jul 2012, 10:47 PM
Hi,

I'm trying to make a GridView that will populate new columns as the user checks boxes. 

Basically... this data:
public class DataPoint
{
  public DateTime DateTime { get; set; }
  public double? Value { get; set; }
}
 
public RadObservableCollection<RadObservableCollection<DataPoint>> GridViewData { get; set; }

Would show up like this:
DateTime, Value1, Value2, ... ,ValueX
July...         5            3                 2

Where as the user checks a box, a new collection of DataPoints is added to GridViewData, which should then automatically generate a new column for the data.

I can't find how to bind a "ColumnCollection" so that as a new collection of DataPoints is added to GridViewData, it is automatically added to the GridView.

Is this behavior possible, or will I need to do the adding and removing and DateTime synchronizing manually?

Thanks

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 24 Jul 2012, 01:30 PM
Hi Chris,

I am afraid the desired behavior can not be achieved with simple bindings only . As you said - you will need to add data and columns with code.

Another concern would be - are all the rows going to share the same set of columns ?

Let me know how I can be in further help.

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Chris
Top achievements
Rank 1
answered on 24 Jul 2012, 02:44 PM
I got the desired behavior by adding new values as dynamic properties in a row class and then creating a column bound to the new property.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Chris
Top achievements
Rank 1
Share this question
or