更新时间:2022-05-22 03:07:40
尝试一下:在您的DataBuilder
类中,有一个函数可以根据您的过滤条件返回项的子集.
Try this: in your DataBuilder
class, have a function that returns a subset of your items based on your filter condition.
例如,在您的DataBuilder
类中:
public BindingList<TableSet> someTableSets()
{
BindingList<TableSet> someTableList = new BindingList<TableSet>();
foreach (TableSet TS in allTableSets)
if (TS.IsPopulated == true)
someTableList.Add(TS);
return someTableList;
}
然后,在您的MainForm
中,将其设置为等于someTableSets()
函数的结果,而不是将DataSource
设置为allTableSets
:
Then, in your MainForm
, instead of setting the DataSource
to allTableSets
, set it equal to the result of the someTableSets()
function:
this.populatedTableSetsListBox.DataSource = dataBuilder.someTableSets();