3
votes

I have a Windows Phone 8.1 ListView. I want to reorder the items in the ListView.I want to initiate the reorder mode on longpress, I can manage it by tapping in to the items Holding event and change the ListViews ReorderMode to Enabled. The ListView looks like this

enter image description here

1. Is there a way to "select" and item as ready to be dragged? So the ListView looks like this? I could not find any property or anything to make it "selected". It would be much better for the user to have the item he initiates the reorder on selected.

enter image description here

2. Is there a way to know the user dropped the item to another places (did the reorder)? I thought I could accomplish it by using the DragOver or DragLeaving events on the ListView, but they are fired when the reorder mode is disabled, not when the item is dropped to another position.

3. Is there a way to make the gaps between the items in reorder mode smaller? I found the ListViewItemReorderHintThemeOffset resource but changing it (directly or editing a style for ListViewItem) does not make any change.

1
As for the 2. - maybe you can try to make use of ListView.Items.VectorChanged event - once the user reorders any item, the event is fired twice, once for removal and once for insertion.Romasz

1 Answers

0
votes

1 and 2 :

You need to capture the PointerPressed event of the ListItem, or in the DataTemplate of the ItemTemplate.

Then set the ReorderMode to Enabled :

        if (ListView != null && ListView.ReorderMode != ListViewReorderMode.Enabled)
        {
            ListView.ReorderMode = ListViewReorderMode.Enabled;
        }