Forums

Drag&Drop without using lists
Last Post 18 Mar 2016 03:04 PM by Filip Dušek. 3 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Resolved
wookie_rookieUser is Offline
New Member
New Member
Posts:9


--
18 Mar 2016 10:57 AM
    Hi,

    i want to do drag items from my inventory (a ListBox using a WrapPanel) to some slots (ContentControls). Both the items in the List and the ContentControls have the same type of ViewModel as DataContext. A simple SlotViewModel with an Item property. I handle DragStarted and DropStarted in code and can easily swap the items inside the viewmodels when i got the drop event.

    I can drag items from inventory list to the slots like a charm. But i cannot drag from slot back to inventory. I've set ekragDrop.IsDragSource to True on the contentContorls but it seems that dragging only works with lists?

    Is there a way to get dragging from ContentControls (or whatever) to work or do i need to handle this entirely in code?

    Thanks..
    Filip DušekUser is Offline
    Advanced Member
    Advanced Member
    Posts:676


    --
    18 Mar 2016 01:40 PM
    • Accepted Answer
    Drag and Drop implementation supports only lists at this moment. I was thinking to replace current custom implementation with generic drag and drop behavior, but didn't have time to make it yet.

    Looking at the code DragStarting event is called only if source is ItemsControl, compared to DropStarting, which is called every time. I could change that, if firing event is enough for you.
    wookie_rookieUser is Offline
    New Member
    New Member
    Posts:9


    --
    18 Mar 2016 02:27 PM
    I'm using a mix between your build in and my custom drag&drop by simply hooking mouse events on my slots and a bit of extra logic. This also avoids the auto reordering of the underlying ObservableCollection because i only swap items in my custom drop handler. So freely sortable inventory.

    It's a bit hacky but under control and i'm fine with it for now. But maybe a bit more drag&drop flexibility is something for the backlog.

    btw: Do you have any plans about adding RenderTransorm support? Combined with animations this will allow very fancy stuff
    Filip DušekUser is Offline
    Advanced Member
    Advanced Member
    Posts:676


    --
    18 Mar 2016 03:04 PM
    RenderTransform is still in backlog under "custom matrix in Render". There are some issues with rotating, scaling etc. I'm using scissor rectangle for masking, which you can't use in that case and any usage of stencil buffer killed the performance drastically. So it's only in backlog for now.
    You are not authorized to post a reply.