Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将我的应用程序集成到 WPF,在我用来ListBox.SetSelected(i, true);显示的代码中Selected Items,它可以正常工作Window Application,但不能使用WPF。提前致谢
ListBox.SetSelected(i, true);
Selected Items
Window Application
WPF
首先你必须设置Selection mode那个List box. 然后在所选项目中添加项目。如下所示。
Selection mode
List box
listBox.SelectionMode = SelectionMode.Multiple; listBox.SelectedItems.Add(seltectedItem1); listBox.SelectedItems.Add(seltectedItem2);