You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
Source=newFlatTreeDataGridSource<Person>(_people){Columns={newTextColumn<Person,string>("First Name", x =>x.FirstName),newTextColumn<Person,string>("Last Name", x =>x.LastName),newTextColumn<Person,int>("Age", x =>x.Age),},};
However, it is NOT possible to use this approach if the type of data is not known in advance. For example, if we replace "Person" with a Row type where the number of columns may vary over time (although all rows in the table will have the same number of columns)
publicclassRow(string[]rowItems){publicstringthis[intindex]{//it's possible to get transient mismatches during update so//just return a dummy value if the binding is temporarily invalidget=>index>=rowItems.Length?string.Empty:rowItems[index];}}
then it would be desirable to write this kind of code...
varrows=result.EnumerateRows().Select(items=>newRow(items)).ToArray();varcolumnList=newColumnList<Row>();columnList.AddRange(result.ColumnDefinitions().Select(col =>newTextColumn<Row,string>(col.Name, r =>r[col.Index])));Source=newFlatTreeDataGridSource<Row>(rows,columnList);
The docs contain this example code....
However, it is NOT possible to use this approach if the type of data is not known in advance. For example, if we replace "Person" with a Row type where the number of columns may vary over time (although all rows in the table will have the same number of columns)
then it would be desirable to write this kind of code...