// Replacing your renderer in our cell renderer collection
grid.CellRenderers.Remove("TextView");
grid.CellRenderers.Add("TextView", new CustomCell());
CustomRenderer.cs public class CustomCell : GridCellTextViewRenderer {
public CustomCell()
{
}
public override void OnInitializeDisplayView(DataColumnBase dataColumn, UILabel view)
{
base.OnInitializeDisplayView(dataColumn, view);
var rowData = dataColumn.RowData as DynamicModel;
// If you want to format all columns based on values row data
//if (Convert.ToInt32(Convert.ToString(rowData.Values["orderID"])) > 10)
//{
// view.TextColor = UIColor.Purple;
// view.Font = UIFont.FromName("AmericanTypewriter-CondensedBold", 20f);
//}
// If you want to format only a particular column
if (Convert.ToInt32(Convert.ToString(rowData.Values["orderID"])) > 10 && dataColumn.GridColumn.MappingName == "Values[orderID]")
{
view.TextColor = UIColor.Purple;
view.Font = UIFont.FromName("AmericanTypewriter-CondensedBold", 20f);
}
}
} |
public class CustomCell : GridCellTextViewRenderer
{
public CustomCell()
{
}
public override void OnInitializeDisplayView(DataColumnBase dataColumn, UILabel view)
{
base.OnInitializeDisplayView(dataColumn, view);
var rowData = dataColumn.RowData as DynamicModel;
if (Convert.ToInt32(Convert.ToString(rowData.Values["orderID"])) > 10 && dataColumn.GridColumn.MappingName == "Values[orderID]")// && Convert.ToInt32(Convert.ToString(rowData.Values["customerID"])) > 100)
{
view.TextColor = UIColor.Purple;
view.Font = UIFont.FromName("AmericanTypewriter-CondensedBold", 20f);
var value = dataColumn.CellValue;
}
}
} |