简体   繁体   中英

C# List of dictionaries to DataGridView

I want to display in datagridview data from List but with All data from dictionary (or list). I have two classes like below. And now I want to list in DataGridView all MeasureSteps from dictionary, one for one row, with multiplying informations from Board class.

What control help me? Or if I can do this with datagridview, just how?

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; }
}

You can use a master-detail form . Alternatively, you can create a grid where rows (of Board ) can expand to display its children (of MeasureStep s), but that would be more complex.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM