Draggin a ListItem to Trash

Jun 25, 2009 at 3:06 PM

Hello,
I really like this control! It's a must have!
Now to my question...

I have a DropTarget with an Image of a TrashCan, and I want that when the user drag&drop an items from my ListBox on it, the item is removed from the list.
Now, I succesfully implemented the DragSource and DragDrop, and on the DragSourceDropped event I remove the ListItem.
But, how can I make the dragged item disappear?
It remains on top of my TrashImage.
I tried something like this:

<font size="2">

 

</font>

private void DropTarget_DragSourceDropped(object sender, DropEventArgs args)
{
MyItem item = args.DragSource.DataContext as MyItem ;

 

<font size="2">

TrashTarget.Content =

</font>

null;
if(item != null)
     Deleteitem (item );
}

But it doesn't seem to work.

Any help?

Thank you,
Max<font size="2">

 

</font>

 

 

 

Jun 26, 2009 at 12:01 PM

Uhm... Maybe I was sleeping, it works!