locked
Detect when listview item is de-selected while ReorderMode is enabled (WP8.1, XAML) RRS feed

  • Question

  • Hello.  I have a ListView with ReorderMode enabled. When user scrolls listview, selected item becomes de-selected. But there's no event fired, nor SelectedItem, SelectedIndex properties changed. I can detect scrolling by handling ScrollViewer's ViewChanged event. But this event is not fired when user is on top of the list and trying to scroll more to top (listview becomes "compressed", item becomes de-selected). Is there any way to detect when listview item is automatically de-selected when ReorderMode is enabled? Or is there a way to detect when listview is "compressed"?
    Tuesday, November 25, 2014 4:46 PM

All replies

  • Can you provide a sample so we can investigate?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, November 25, 2014 9:22 PM
  • Here is sample project - http://1drv.ms/1Cf0qrX

    Here is a short video with my problem - http://1drv.ms/1rsKJDm

    Steps to reproduce:

    1. Click Reorder button (appbar button is disabled)
    2. Tap on some item in listview - appbar button is enabled
    3. Scroll listview to top - listview is "compressed", selected item is automatically de-selected, but appbar button is enabled because I can't detect when item is de-selected in reorder mode.


    • Edited by Ivan__S Wednesday, November 26, 2014 10:45 AM formatting fix
    Wednesday, November 26, 2014 10:45 AM
  • So this scenario doesn't make sense:

    1) You have selectionmode = none in the XAML, so there are no selections to be made in any case

    2) When you're in reorder mode, there are no selections - you are actually supposed to be reordering the list, not making a selection from the list

    3) You can start reselecting when you set reorder mode to disabled.

    Does this make sense?


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, November 26, 2014 4:47 PM
  • It makes sense. When user taps item in reorder mode it is visually "selected", it shows that something can be done with this item. I need to provide some context actions for tapped item (using command bar). And I detect that selection by handling ItemClick and DragItemsStarting. And my problem is that item is visually "de-selected" when user scrolls listview but no event fired nor any property changed that I can detect.
    Wednesday, November 26, 2014 4:58 PM
  • No, it's not "selected" in the sense that you should be handling events that mean that there's been an item selected. This selection state is for moving, not for further processing.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, November 26, 2014 5:42 PM
  • I understand that. My scenario is that I let user manage this list. Reorder items, remove "selected" item, make some other action on "selected" item. It is very confusing that you can reorder items on one "screen" (user have to enable reorder mode), but any other item actions on the other "screen" (I have to provide some visual clues that user can select item because in my case application is navigating to another page when user taps list item). So there're two "list management" modes in application, first is for reordering and second for items removal etc.
     That is why I'm trying to detect item selection while in reorder mode, to have single list management screen/mode.
    • Edited by Ivan__S Wednesday, November 26, 2014 6:22 PM .
    Wednesday, November 26, 2014 6:18 PM
  • So... manage the reordering in some other way, or give context that this is a reordering mode.  Don'tmake it confusing if that's what you find it to be.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, November 26, 2014 6:21 PM
  • I don't make it confusing, I'm trying to make one list management mode instead of two (reordering and selecting items to do some other actions). Two management modes for a list - that is confusing.
    Wednesday, November 26, 2014 6:41 PM