WPF替换特定的ListView项

kev*_*ev3 0 c# wpf listview

无论如何都要删除listView中特定索引处的项目,并用该指定索引处的新项目替换该项目.

我可以打电话 ListView.Items.RemoveAt(index);

但是我无法找到替换该索引处的项目的方法.

这里的任何帮助将非常感激.

Say*_*yse 5

你应该能够使用插入.

ListView.Items.RemoveAt(index);
ListView.Items.Insert(index, item);
Run Code Online (Sandbox Code Playgroud)

也未经测试,但我不明白为什么不能ListView.Items[index] = ...工作