// bind a cell to a range public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange range) { // get row/col var row = grid.Rows[range.Row]; var col = grid.Columns[range.Column]; var gr = row as GroupRow; // no border for group rows if (gr != null) { bdr.BorderThickness = _emptyThickness; } // bind first cell in each group row to collapse/expand if (gr != null && range.Column == 0) { BindGroupRowCell(grid, bdr, range); return; } // bind regular data cells switch (col.ColumnName) { // show names with images case "Name": bdr.Child = new SongCell(row); return; // show ratings with stars case "Rating": var song = row.DataItem as Song; if (song != null && gr == null) { var cell = new RatingCell(); cell.SetBinding(RatingCell.RatingProperty, col.Binding); bdr.Child = cell; } return; } // default binding base.CreateCellContent(grid, bdr, range); }
public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange range) { // get row/col var row = grid.Rows[range.Row]; var col = grid.Columns[range.Column]; // bind regular data cells switch (col.ColumnName) { // show ratings with stars case "Rating": var video = row.DataItem as Video; if (video != null) { var cell = new RatingCell(); cell.SetBinding(RatingCell.RatingProperty, col.Binding); bdr.Child = cell; } return; } // default binding base.CreateCellContent(grid, bdr, range); }