Assume I have a class that looks like this:
class Sample
{
public string Value { get; set; }
public DateTime Begin { get; set; }
public DateTime End { get; set; }
}
I want to display a list of Sample instances where each one changes color when the current time passes Begin and then changes color again when the current time passes End.
For example, say I have a DataGrid containing a Sample sort of like this:
dataGrid1.ItemsSource = new List<Sample> {
{ Value="123",
Begin=DateTime.Parse("10:00"),
End=DateTime.Parse("11:00") } };
How would I get the row showing “123” to be red at 9:59, turn yellow at 10:00, and turn red at 11:00?
EDIT: One thing I’m particularly concerned about is a timer explosion. If I have 10,000 Samples, will it be a problem to have 10k (or 20k) timers? What if I have 1M Samples? I think it might be a better idea to make the timers per grid row rather than per Sample.
By doing this:
MainPage.xaml
MainPage.xaml.cs