c# - How to bind all the items in a list to DataGridView? -


i have class zones has list of objects of type row. i'm trying datagridview display rows in of zones. code gives me rows first zone in list aircraft.zones.

bindingsource mysource = new bindingsource();   mysource.datasource = aircraft.zones; mysource.datamember = "rows"; 

the zone class looks this

public class zone {     public list<row> rows{ get; set; }     public string name { get; set; }     double arm;     private int id; } 

i can inserting rows datatable binding don't want changes won't updated. ideas how can rows in zones show up?

thanks.

try this, think work including updates, although not inserts or deletes:

mysource.datasource = aircraft.zones.selectmany(t => t.rows).tolist(); 

(and remove datamember assignment)


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -