我使用一个days
字段(即 a BindingList<Day>
)作为 aDataSource
的 a ListBox
。我有以下一段代码:
if (seasonId >= 0)
{
context.DbPerform((SQLiteConnection connection) =>
{
foreach (var item in DBProcessor.DBSelectCustom(
connection,
"SELECT * FROM Days WHERE SeasonId=@seasonId;",
(SQLiteCommand cmd) =>
{
var seasonIdParam = cmd.CreateParameter();
seasonIdParam.ParameterName = "@seasonId";
seasonIdParam.Value = seasonId;
cmd.Parameters.Add(seasonIdParam);
},
DayFactory.Instance))
{
days.Add(item);
}
});
}
我已经检查了调试器,在days.Add(item);
ListBox
'sSelectedIndex
从 -1 更改为 0 之后。但是,没有SelectedIndexChanged
触发任何事件。为什么?难道我做错了什么?