ButchersBoy / Dragablz

Dragable and tearable tab control for WPF
http://dragablz.net
MIT License
2.21k stars 327 forks source link

Add drag events to DragablzItemsControl #82

Open mgnslndh opened 8 years ago

mgnslndh commented 8 years ago

It would be nice to have drag events on the DragablzItemsControl so that you can use "event-to-command" binding in MVVM scenarios and let the view model get notified.

Today I have to use AddHandler on the view to add a routed event handler and manually invoke the command on the view.

In my specific scenario I use the control to order items by dragging them in the desired order. I am interested in the DragCompleted event so that I can commit the order of items to their view models.

ButchersBoy commented 8 years ago

Currently we have the PositionMonitor which allows communication back to view models without having to use the said pattern (.Interactivity, or whatever).

I will expand this t provide more information. Currently it gives "real time" X,Y updates, but I can also add an event for when a drag operation completes.

ButchersBoy commented 8 years ago

wowsers.

I already did this. A long time ago. You want to use a StackPositionMonitor (HorizontalPositionMonitor). It's already in action in the demo.

ButchersBoy commented 8 years ago

Although I guess the event would still be useful, unless you put a throttle on the StackPositionMonitor

mgnslndh commented 8 years ago

Yes, I am using the HorizontalPositionMonitor but It would be nice if it provided notification of the order when the drag is complete in a separate event.

The current implementation allows me to indicate when the user is reordering items but I also want to know when the drag is complete which means the order is set and should be updated to some other items.

reorder

ButchersBoy commented 8 years ago

OK cool.

sekulicb commented 7 years ago

Is this handled ? Just asking because i need to implement it too. By the way how did you manage to implement HorizontalPositionMonitor? In my project I crate instance of this class and listen for OrderChanged event but that event never fires...what I am doing wrong? Thanks