I've read this solution: How do I make a ListBox refresh its item text?
But I'm still having no luck getting the text displayed in the listBox to update when the object's property changes.
public partial class Form1 : Form
{
public BindingList<Channel> chanList = new BindingList<Channel>();
private void Form1_Load(object sender, EventArgs e)
{
lbChannels.DisplayMember = "Display";
lbChannels.DataSource = chanList;
}
}
public class Channel
{
public string Display
{
get
{
return ToString();
}
}
public override string ToString()
{
if(!unread || DateTime.Now.Second % 2 == 0)
return Name;
return "";
}
}
The goal here is to cause the channel name to blink in the listBox if there's unread data in it, but when I test it nothing happens. I've also tried calling lbChannels.Refresh() and lbChannels.Update().
I must be missing something but I can't figure out what. The solution in the other thread seems almost too simple to be true, but I've looked through it several times and I can't find anything else related to the listBox. What am I missing here?