Right now, i am able to drag an item from listView 1 to listView 2. how do you clone/copy/move the item's data across? Gif of what i mean here
widgetList is listView1. aka the list on the far right.
private void fillWidgetList()
{
widgetList.Groups.Add(new ListViewGroup("System", HorizontalAlignment.Left));
var cpu = new ListViewItem { Text = "CPU", Tag = "", Group = widgetList.Groups["System"] };
var ram = new ListViewItem { Text = "RAM", Tag = "", Group = widgetList.Groups["System"] };
widgetList.Items.Add(cpu);
widgetList.Items.Add(ram);
}
widgetCollectionList is listView2. aka the list in the middle.
private void widgetList_ItemDrag(object sender, ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
// am i suppose to save the dragged item somewhere?
}
private void widgetCollectionList_DragEnter(object sender, DragEventArgs e)
{
//e.Effect = DragDropEffects.Copy;
if (e.Data.GetDataPresent(typeof(ListViewItem)))
{
e.Effect = DragDropEffects.Move;
}
}
private void widgetCollectionList_DragDrop(object sender, DragEventArgs e)
{
widgetCollectionList.Items.Add(e.Data.ToString()); // What do i replace this with?
}
private void WidgetMaker_Load(object sender, System.EventArgs e)
{
widgetCollectionList.AllowDrop = true;
widgetCollectionList.DragDrop += new DragEventHandler(widgetCollectionList_DragDrop);
}
DoDragDrop
– Eighteenmo