有人可以解释这种行为吗?
不仅MouseOver
突出显示多个项目(不打算),而且当我Select
项目时(鼠标悬停)代码转到 Selection_Changed 事件,该事件会更改其右侧的图片(按预期)但在加载图片时,出现错误出现消息,指出路径中有无效字符。
BD.Shape xShape = new BD.Shape();
comboBoxShapes.ItemsSource = xShape.GetListOfShapes();
public List<String> GetListOfShapes()
{
List<String> iList = new List<String>();
try
{
GetConnectionString iGet = new GetConnectionString();
System.Data.OleDb.OleDbConnection iConnect = new System.Data.OleDb.OleDbConnection();
iConnect.ConnectionString = iGet.ConnectionString();
iConnect.Open();
System.Data.OleDb.OleDbCommand iCommand = new System.Data.OleDb.OleDbCommand();
iCommand.Connection = iConnect;
iCommand.CommandText = "Select ShapeName from Shapes ";
System.Data.OleDb.OleDbDataReader iRead = iCommand.ExecuteReader();
while (iRead.Read())
{
Shape iShape = new Shape();
iShape.ShapeName = iRead["ShapeName"].ToString();
iList.Add(iShape.ShapeName);
}
}
catch
{
MessageBox.Show("Someone better call batman or something `\\(^_^)_/`");
}
return iList;
}
请注意,如果我选择任何其他带有破折号-
的东西,它只会选择一个项目。没有隐藏/无效字符....