I want to refresh my list because right now I have a custom List with a sub List and I want to have each sub list entry as a separate line.
Now this "works" as in when I first set the databind GetList() is called. But how do I refresh the datasource? Like when I add some entries I want to update the listbox.Code:class WDFFileList : List<WDFFile>, System.ComponentModel.IListSource { public bool ContainsListCollection { get { return true; } } public System.Collections.IList GetList() { List<WDFEntry> entries = new List<WDFEntry>(); foreach (WDFFile f in this) { foreach (WDFEntry e in f.Entries) { entries.Add(e); } } return entries; } }
I have tried
But GetList() wasn't called.Code:UsageList.DataSource = null; UsageList.DataSource = Files;
Just tried this
Still didn't update.Code:class WDFFileList : List<WDFFile>, System.ComponentModel.IListSource { public List<WDFEntry> Entries = new List<WDFEntry>(); public void Refresh() { Entries.Clear(); foreach (WDFFile f in this) { foreach (WDFEntry e in f.Entries) { Entries.Add(e); } } } public bool ContainsListCollection { get { return true; } } public System.Collections.IList GetList() { return Entries; } }
How do you update a custom datasource? Or am I approaching this wrong?




Reply With Quote