Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF替换特定的ListView项_C#_Wpf_Listview - Fatal编程技术网

C# WPF替换特定的ListView项

C# WPF替换特定的ListView项,c#,wpf,listview,C#,Wpf,Listview,是否可以在listView中删除特定索引处的项,并在指定索引处用新项替换该项 我可以调用ListView.Items.RemoveAt(index) 但是我找不到一种方法来替换索引中的项目 非常感谢您的帮助。您应该能够使用 也未测试,但我不明白为什么ListView.Items[index]=…不应该工作您应该能够使用 也未测试,但我不明白为什么ListView.Items[index]=…不应该工作Insert工作。谢谢ListView.Items[索引]=。。。我没有工作,我遇到了一些出界的

是否可以在listView中删除特定索引处的项,并在指定索引处用新项替换该项

我可以调用
ListView.Items.RemoveAt(index)

但是我找不到一种方法来替换索引中的项目

非常感谢您的帮助。

您应该能够使用

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

您应该能够使用


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

Insert工作。谢谢ListView.Items[索引]=。。。我没有工作,我遇到了一些出界的问题,这些问题没有意义好吧,公平地说,如果它是列表中的最后一个元素,它可能会失败。。(我原以为insert也会在同一点上)insert有效。谢谢ListView.Items[索引]=。。。我没有工作,我遇到了一些出界的问题,这些问题没有意义好吧,公平地说,如果它是列表中的最后一个元素,它可能会失败。。(我原以为insert也会在同一点上)
ListView.Items.RemoveAt(index);
ListView.Items.Insert(index, item);