有人可以解釋這種行爲嗎?組合框選擇多個項目
不僅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;
}
請注意,如果我選擇其他任何在它破折號-
只選擇一個項目。有沒有隱藏/無效的字符....
請解釋一下你說的「它」是什麼。 (「它」運行代碼...「它」說...「它」只選擇一個項目......) –
然後更新問題而不是假設。組合框的選擇模式是什麼?底部的樣本是什麼? – Paparazzi
選擇模式是否設置爲下拉列表? – Derek