I have a Student object which has:
private string name;
private double feesOwed;
I also have a ListBox which will have an ItemSource set to a List object populated with several Students. I would like to have the ListBox display the name as its Text and have a background coloured based on feesOwed. Something like
if(feesOwed>20)
{
if(feesOwed>100)
{
item.Background = "Red";
return;
}
item.Background = "Yellow";
return;
}
All of the examples I've found about this mostly just talk about how to get alternating row colours. I know this will require Data Binding but the topic is fairly new to me and I can't quite get it to work dynamically.
I think the correct way to do this is to implement IValueConverter but this is also a little daunting.
Thanks