Igor Kulman
Igor Kulman

Reputation: 16361

Reordering in Windows Phone 8.1 ListView

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.

Upvotes: 3

Views: 641

Answers (1)

M3rken
M3rken

Reputation: 16

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;
        }

Upvotes: 0

Related Questions