简体   繁体   中英

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 ListView s ReorderMode to Enabled . The ListView looks like this

在此输入图像描述

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.

在此输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM