public SelectedVm() { var rowVms = new List <RowVm>(); int count = 1; for (int i = 0; i < 3; i++) { var rowVm = new RowVm("Row" + i); rowVms.Add(rowVm); for (int j = 0; j < 2; j++) { var itemVm = new ItemVm(count); rowVm.Add(itemVm); count++; } } this.RowVms = rowVms; this.AllRowsItems = rowVms.SelectMany(x => x).ToList(); }
public Vm() { Data2D = new[, ] { { 1, 2 }, { 3, 4 }, { 5, 6 } }; ColumnHeaders = new[] { "Col1", "Col2" }; JaggedRows = new int[3][]; JaggedRows[0] = new[] { 1, 2 }; JaggedRows[1] = new[] { 3, 4 }; JaggedRows[2] = new[] { 5, 6 }; int count = 1; ListOfListsOfItems = new List <List <ItemVm> >(); RowVms = new List <RowVm>(); AllRowsItems = new List <ItemVm>(); for (int i = 0; i < 3; i++) { var row = new List <ItemVm>(); ListOfListsOfItems.Add(row); var rowVm = new RowVm("Row" + i); RowVms.Add(rowVm); for (int j = 0; j < 2; j++) { row.Add(new ItemVm(count)); var itemVm = new ItemVm(count); rowVm.Add(itemVm); AllRowsItems.Add(itemVm); count++; } } ColumnItemHeaders = Enumerable.Range(0, 2) .Select(x => new ItemVm(x)) .ToArray(); RowHeaders = Enumerable.Range(0, 3).Select(x => "Row" + x).ToArray(); }