开发者

create a binding from a DataListView to a list consisting of a list

I want to create a two way binding from a DataListView to a list consisting of a list. How do I do that?

Based on the code below, I create a list like this:

   probe1 probe2 probe3 probe4 ...
1  12.3   4.2    6.3    12.5 
2  65.2   2.5    12.4   54.6 
3  54.2   64.3   21.5   22.2 
. . .
  • Row header is the row in Value开发者_StackOverflow中文版s. <372 values
  • Column header is row in Probes. <120 probes
  • Totalt max 44640 values but usually a few thousand values

And the code

public IList<Probe> Probes{get;private set;}

public class Probe
{
   public Probe(int maxValues)
   {
      Values = new double[maxValues];
   }
   public IList<double> Values{get;private set}
}


You have to flatten the list first. Create a new type like ProbeValue containing both the property Value:double and Probe:Probe. Then create a new CollectionView from the flattened result and apply a GroupDescription on the Probe property. Bind your listview against that

http://msdn.microsoft.com/en-us/library/system.windows.data.collectionview.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜