locked
Reorder items on grouped ListView? RRS feed

  • Question

  • Hi,

    Short question: is it possible to reorder items in a grouped ListView in XAML for WinRT/.NET/C# with the "standard" capabilities? With a "normal" ListView, when I set the CanReorderItems/CanDragItems/AllowDrop properties to true, the ListView is automatically reordering bound items from a CollectionViewSource. Unfortunately, when I have a grouped CollectionViewSource and a ListView with a GroupStyle, reordering per drag&drop isn't working per default.

    I can understand that reordering in different groups perhaps doesn't work automatically, but is there a way to get it to work with programmatic support

    Thanks, Matthias


    Friday, May 25, 2012 7:25 AM

Answers

  • No GridView does not provide any support for automatically reodering content in grouped scenarios. You will have to write code for that.

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"
    Friday, May 25, 2012 10:21 PM

All replies

  • No GridView does not provide any support for automatically reodering content in grouped scenarios. You will have to write code for that.

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"
    Friday, May 25, 2012 10:21 PM
  • Does this count for a grouped ListView, too? I never mentioned a GridView...

    And do you mean with "you will have to write code for that" that I set CanDragItems/AllowDrop to true and attach a handler to the Drop event, where I have to find out the drop position by physical coordinates?

    Thanks, Matthias


    Monday, May 28, 2012 4:02 PM
  • Yes that includes grouped ListView. (ListView and GridView derive from ListViewBase which have the same features).

    There is not easy way to find where the drop position is at in relation to items in the list. You will have to enumerate over the visual items in the list using VisualTreeHelper and get the bounding rectangles for each item to determine where the drop should occur.

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

    Tuesday, May 29, 2012 5:16 PM