protected virtual void DisplayModels(IList <TSGridRowModel> models) { var maxRows = !MaxRows.HasValue ? models.Count : MaxRows.HasValue && models.Count > MaxRows.Value ? MaxRows.Value : models.Count; for (int i = 0; i < maxRows; i++) { if (!_rows.ContainsKey(i)) { var newRow = new TSGridRow() { Model = new TSGridRowModel() { Index = i }, Dock = DockStyle.Top, ValueColumnWidth = ValueColumnWidth }; _rows.Add(i, newRow); pnlGridRows.Controls.Add(newRow); newRow.BringToFront(); } var row = _rows[i]; row.Model = models[i]; } }
private void addItem(int index) { //ListViewItem item = getListViewItem(index); //this.Items.Insert(index, item); TSGridRow item = getTSGridRow(index); pnlGrid.Controls.Add(item); }
private void updateItem(int index) { if (index >= 0 && index < this.Items.Count) { //ListViewItem item = getListViewItem(index); //this.Items[index] = item; TSGridRow item = getTSGridRow(index); this.Items[index] = item; //pnlGrid.Controls[index] = item; } }