我使用days
字段(BindingList<Day>
)作为DataSource
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
的{{1}}从-1更改为0.但是,没有SelectedIndex
事件被触发。为什么?我做错了吗?