选定值我最初在listBox
添加一些字符串对象,事后我想设置所选的项目:设置列表框的WPF
List <string> CustName = new List<string>();
....///add items to CustName///...
listBox1.ItemsSource = CustName;
string selection = "myselection" ///this string is contained in CustName
listBox1.SelectedValue = selection;
但是塔上面不起作用作用似乎是选择的项目是该listBox
而不是一个我尝试设置的第一项...
您是否尝试过'listBox1.SelectedIndex = indexOfMySelection'? – 2014-08-29 10:41:01