Drag and Drop in grouped GridView? RRS feed

  • Question

  • I would like to be able to rearrange items in a grouped GridView by dragging and dropping them on a touch-enabled device; both within a group and between the groups.

    It is my impression that even with the latest updates this still requires some wiring of DragItemsStarting and Drop events. And to achieve rearrangement within a group this wiring gets very ugly, very fast (down to resolving the underlying items using current coordinates).

    Is this functionality ever going to be supported out of the box?

    Some older threads (from over a year ago and before) indicate that this feature is not supported, and some custom handling behind the scenes is required (such as in the GridViewEx example posted on CodeProject).

    Well, Windows 8 has been around for a while, and has seen updates (including the major 8.1).
    Don't you think it would make sense to stop torturing the developers and start supporting this very basic UX without extra work on our behalf?

    Or maybe I am missing something, and everything already works? In such case please direct me to the relevant samples.

    Tuesday, April 29, 2014 6:43 PM

All replies

  • You need to write some code for this. It shouldn't be torturous. See How to drag item between groups in grouped gridview for an example.


    Tuesday, April 29, 2014 7:45 PM
  • Hi Rob, thank you for your reply.

    Yes, I have looked into that example already. Unfortunately, it only deals with moving items from one group to another, and not with rearrangement within a group. The latter is much more of an issue because the Drop event does not provide any indication of where in the group the dragged item was dropped. As a result, as far as I understand, I will have to override the OnDragOver, search the visual tree, and keep the track of the current item over which the dragged item is being moved... And that is much more work than I'd consider reasonable for such a basic UX action in the Windows Store apps paradigm. Wouldn't you agree?

    And again, if I am completely off the target here, please feel free to refer me to a sample project showcasing the in-group reordering that I'm trying to achieve.

    Tuesday, April 29, 2014 11:01 PM
  • I'm not aware of a sample specifically on rearranging within a group other than the GridViewEx sample you mentioned. If that is more code than you are willing to write then you'll need to reconsider that feature for your app.


    Wednesday, April 30, 2014 2:09 PM
  • This is a very disappointing and frustrating reply, Rob.

    A reply that I'd rather see would be something like:

    "You are right, this is a very basic piece of functionality indeed, that we at Microsoft are yet to catch up upon. Many developers have raised this concern in the past two years, and I will make sure that the framework team makes this a high priority item for their very next update pack.

    In the mean time, here is a sample project created by our team to illustrate the temporary workaround for the issue."

    If you were in my shoes, wouldn't you rather read something like that?

    Wednesday, April 30, 2014 2:29 PM
  • You can request samples at http://code.msdn.microsoft.com/site/requests and we'll prioritize the ones with the most interest.

    As you pointed out in your original post, this is already demonstrated in the GridViewEx project.


    Wednesday, April 30, 2014 3:12 PM