I use Listboxwrapped inside ListBoxDragDropTarget(from the Silverlight toolkit). This Listboxca will be manually reordered by the user. However, the last element should always be located at the bottom Listboxand cannot be moved at all. I found a way to undo this last move of the element, but if I drag another element below this last element, it will be moved.
I can find the index of the item being dragged using this code in the DropListBox event :
object data = e.Data.GetData(e.Data.GetFormats()[0]);
ItemDragEventArgs dragEventArgs = data as ItemDragEventArgs;
SelectionCollection selectionCollection = dragEventArgs.Data as SelectionCollection;
if (selectionCollection != null)
{
MyClass cw = selectionCollection[0].Item as MyClass;
int idx = selectionCollection[0].Index.Value;
}
However, this only gives me the index before the drag operation.
My question is this: is there a way to find out the new index of the dropped item? Thus, if index = last position of the list, I can move it to the extreme position.
Thanks in advance!
source
share