dotnet / dotnet/dotnet-api-docs
Don't need to clone draggedItem
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
@lulianqi commented on [Sat Nov 03 2018](https://github.com/dotnet/dotnet-api-docs.zh-cn/issues/3)
draggedItem will not dispose when remove
so we can Insert it still
maybe below code will be better (in the myListView_DragDrop)
```
int targetIndex = myListView.InsertionMark.Index;
if (targetIndex == -1)
{
return;
}
ListViewItem draggedItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));
myListView.Items.Remove(draggedItem);
myListView.Items.Insert( targetIndex, draggedItem);
```
---
#### 文档详细信息
⚠ *请勿编辑此部分。 docs.microsoft.com ➟ GitHub 问题链接必须具有此部分。*
* ID: 05bde473-96e7-99c5-8248-a2b8387febec
* Version Independent ID: 7d3652ed-efda-62c8-0c9f-8cc9d728d147
* Content: [ListView.InsertionMark Property (System.Windows.Forms)](https://docs.microsoft.com/zh-cn/dotnet/api/system.windows.forms.listview.insertionmark?redirectedfrom=MSDN&view=netframework-4.7.2#System_Windows_Forms_ListView_InsertionMark)
* Content Source: [xml/System.Windows.Forms/ListView.xml](https://github.com/dotnet/dotnet-api-docs.zh-cn/blob/live/xml/System.Windows.Forms/ListView.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**
Contributor guide
Assessment
This issue has not been assessed yet.