public void LinkGrid() { if (!makeGridCompleted) { throw new Exception("MakeGrid not completed"); } LinkedCells.Clear(); LinkedRows.Clear(); if (MyDataBC == null) { throw new Exception("Bad MyData"); } for (int i = 0; i < gridRowList.Count; i++) { var rowdef = gridRowList[i]; try { rowdef.LinkRow(); rowdef.UpdateDataCell(); } catch (Exception ex) { throw new Exception("LinkRow failed: " + rowdef.Name, ex); } } }
public void OnPropertyChanged(string propname = null) { if (propname == null) { return; } IReadOnlyCollection <MyGridRowBase> gridrows; if (LinkedRows.TryGetValue(propname, out gridrows)) { object val = Utils.GetProperty(MyData, propname); foreach (var gr in gridrows) { gr.Value = val; } return; } CellContext cc; if (LinkedCells.TryGetValue(propname, out cc)) { object val = Utils.GetProperty(MyData, propname); cc.Cell.Model.ValueModel.SetValue(cc, val); } }
public void MakeGrid() { LinkedCells.Clear(); LinkedRows.Clear(); this.ColumnsCount = 3; this.Columns[0].Width = ColumnWidth1; this.Columns[1].Width = ColumnWidth2; this.Columns[2].Width = ColumnWidth3; for (int i = 0; i < gridRowTemplateList.Count; i++) { var rowdef = gridRowTemplateList[i]; rowdef.MakeTemplateRow(this); } int rowscount = 0; for (int i = 0; i < gridRowList.Count; i++) { rowscount += gridRowList[i].GetRowCount(); } this.RowsCount = rowscount; int rownr = 0; for (int i = 0; i < gridRowList.Count; i++) { var rowdef = gridRowList[i]; rowdef.MakeRow(Rows[rownr]); rownr += rowdef.GetRowCount(); } ScaleControlA(scaleFactor); this.Controller.AddController(MarkCurrentRowController.Default); makeGridCompleted = true; }