Is there a way to dynamically set TextCell color based on each itemsource value?
VehicleList.ItemsSource = vehicleList;
VehicleList.ItemTemplate = new DataTemplate (typeof(TextCell)) {
Values = {
{ TextCell.TextColorProperty, TextColor(???)} // ie vehicleList[index].status
},
Bindings = {
{ TextCell.TextProperty, new Binding("VIN") }
}};
}
private Xamarin.Forms.Color TextColor (string status) {
switch (status) {
case "Loading":
case "Delivering":
return Color.Red;
case "Loaded":
case "Delivered":
return Color.Green;
default:
return Color.Black;
}
}