I have a very simple class
public class SimpleClass // abreviated for this example
{
public bool HighAlert {get;set;}
public bool LowAlert {get;set;}
// about 10 other bools
}
They are all boolean prorties. I could also use a struct or possibly an array if that makes things easier.
I’d like to databind to a listbox AND have the items that are “true” highlighted in blue or red. And of course have the listbox updated when my object instantiated from SimpleClass changes. My only other requirement is to have something in the list box other than the member names. For example, it might be nice to have “Low Bank Account Alert” rather than “LowAlert”.
And of course, the more this is automated (listbox actually using the SimpleClass) the better, for that inevitable day when someone adds a property to SimpleClass.
Any examples or tutorials? I would think this is a fairly common scenario.
Thanks,
Dave
you question seems to be twofold.
1) Conditional Formatting. you can use Triggers on the your list box, like this:
2) Displaying ListBox items differently. in WPF, you can use ItemTemplate:
both are widely used, pls google for any detailed examples, hope you got the gist