I have overridden OnInitializeDisplayView in my GridCellTextViewRenderer-derived class to change text color depending on a boolean in my model.
public override void OnUpdateDisplayValue(DataColumnBase dataColumn, SfLabel view)
{
base.OnInitializeDisplayView(dataColumn, view);
if ((dataColumn.RowData as Player).InPlay == false)
{
view.TextColor = Color.FromRgba(50, 50, 50, 50);
}
}
and added it to the grid like this
sfGrid.CellRenderers.Remove("TextView");
sfGrid.CellRenderers.Add("TextView", new GridCellTextViewRendererExt());
This works find when the grid is first displayed, but if I change my underlying data model (in my case, after dragging a row to a new location) then my method above is not called, and the rows are drawn as default. How can I make this code called whenever the grid is drawn?
I've tried overriding OnUpdateDisplayValue
public override void OnUpdateDisplayValue(DataColumnBase dataColumn, SfLabel view)
{
base.OnUpdateDisplayValue(dataColumn, view);
if ((dataColumn.RowData as Player).InPlay == false)
{
view.TextColor = Color.FromRgba(50, 50, 50, 50);
}
}
but it is never called. Thanks.