2012-06-29 35 views
1

我想顯示在List中的datagridview數據中,但與來自字典(或列表)的所有數據一起顯示。 我有兩個類如下。現在我想在DataGridView中列出字典中的所有MeasureSteps,一行一行,乘以Board類的信息。C#DataGridView字典的列表

什麼控制幫助我?或者,如果我可以用datagridview做到這一點,只是如何?

class Board 
{ 
    public string Station { get; set; } 
    public DateTime TestDate { get; set; } 
    public string TestProgram { get; set; } 
    public string TestRevision { get; set; } 
    public string ArticleNumber { get; set; } 
    public bool Result { get; set; } 
    public string SerialNumber { get; set; } 
    public string Operator { get; set; } 
    public string BatchNumber { get; set; } 
    public string TestTime { get; set; } 
    public string TestObjectRevision { get; set; } 
    public string TestObjectDescription { get; set; } 
    public string TestObjectName { get; set; } 
    public string InstrumentInventoryNumber { get; set; } 
    public string InstrumentArticleNumber { get; set; } 
    public string InstrumentName { get; set; } 
    public Dictionary<string,MeasureStep> Measurements { get; set; } 
} 
class MeasureStep 
{ 
    public string TestFunction { get; set; } 
    public string Descripton { get; set; } 
    public double LowerLimit { get; set; } 
    public double UpperLimit { get; set; } 
    public double MeasuredValue { get; set; } 
    public string Unit { get; set; } 

    public bool Result { get; set; } 
} 
+0

你可以看看這裏http://stackoverflow.com/questions/854953/datagridview-bound-to-a-dictionary –

回答

0

您可以使用master-detail form。或者,您可以創建一個網格,其中的行(Board)可以展開以顯示其子(MeasureStep s),但這會更復雜。