Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:56
    Metritutus commented #336
  • Jul 23 18:23
    Metritutus commented #336
  • Jul 23 08:38
    GuangZhouDekang commented #307
  • Jul 19 08:48

    punker76 on develop

    Fix build (compare)

  • Jul 19 08:38

    punker76 on develop

    Fix build (compare)

  • Jul 19 08:34

    punker76 on develop

    Update dev dependencies and min… (compare)

  • Jul 15 13:18
    Metritutus commented #336
  • Jul 15 13:18
    Metritutus commented #336
  • Jul 15 11:33
    Metritutus commented #336
  • Jul 15 11:33
    Metritutus commented #336
  • Jul 15 11:32
    Metritutus commented #336
  • Jul 15 11:32
    Metritutus commented #336
  • Jul 15 11:30
    Metritutus commented #336
  • Jul 15 11:29
    Metritutus commented #336
  • Jul 15 11:29
    Metritutus commented #336
  • Jun 30 23:35
    p4j4dyxcry closed #317
  • Jun 16 12:56
    wf-soft opened #376
  • Jun 08 09:25
    punker76 closed #375
  • Jun 08 09:25
    punker76 commented #375
  • Jun 08 09:06
    rmodig opened #375
Jan Karger ツ ☀
@punker76
@SezMe Yes, I tried to compile this, but had no luck.
Martin Wollmann
@doc_mw_twitter

When i'm using the gong-wpf-dragdrop library, my Notifycollectionchanged action events are incorrect. When drag and Drop inside a ListView, the events > Remove, followed by Add are raised, not the removed. Don't know if this has been asked before or if this is the right place.

void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
ObservableCollection<Item> obsSender = sender as ObservableCollection<Item>;
Item m = new Item();
NotifyCollectionChangedAction action = e.Action;
switch(action)
{
case NotifyCollectionChangedAction.Add:
{
m = ((Item)obsSender[e.NewStartingIndex]);
Console.WriteLine("ADD");
break;
}
case NotifyCollectionChangedAction.Remove:
{
m = ((Item)e.OldItems[0]);
Console.WriteLine("REMOVED");
break;
}
case NotifyCollectionChangedAction.Move: Console.WriteLine("TEST >>> MOVED ");break;
case NotifyCollectionChangedAction.Reset: break;
case NotifyCollectionChangedAction.Replace: break;
}

Jan Karger ツ ☀
@punker76
@doc_mw_twitter Yes, this should be fixed by punker76/gong-wpf-dragdrop#362
@doc_mw_twitter It’s not released yet, need some wake up time from my OSS time, but it’s coming soon.
Martin Wollmann
@doc_mw_twitter
@punker76 Brilliant. Thank you.
bflink
@bflink
DragAdornerViewBox.gif
@punker76 Hello, above is an animated gif showing the showcase application with the main "Grid" wrapped in a Viewbox that reduces the actual size quite abit . As you can see, when you drag an item, the drag adorner has the size of the control being dragged as if the viewbox was not in place. Does that make sense? Sorry if its not clear.
Jan Karger ツ ☀
@punker76
@bflink Would be nice if you can a simple sample with this issue. Thx
Jan Karger ツ ☀
@punker76
@SezMe I can't find a problem with the latest stable version 2.3.2
gong_vb_issue.gif
Tim
@timunie
Hi Jan
I have an idea for an improvement but I am unsure if this is possible and or needed for this lib.
Jan Karger ツ ☀
@punker76
@timunie let's chat in pr
Matthew Olivo
@SaviorXTanren
Hi, I'm trying to see if there's a way to add any sort of filtering mechanism to have DragDrop avoid grabbing drag/drop events that I don't want it to or some customized logic to do something different for specific circumstances. Specific example: I have a window that currently uses DragDrop to allow users to drag elements in a list. However I also want to allow users to be able to drag an external file onto the window and have it perform a different action. I have logic to handle the second scenario already, however if the user drags the file over into the window too quickly and it makes contact with the list before the main window, DragDrop swallows the drag event and throws a wrench into my logic. So basically some way for me to check what the contents of the drag is when it hits the library so I can determine whether DragDrop should ignore it or not.
Tim
@timunie
Hi @SaviorXTanren consider implementing IDropTarget to your ViewModel. There you may do your checks and do this:
void IDropTarget.DragOver(IDropInfo dropInfo)
{
    if (DoYourCheckHere)
    {
        GongSolutions.Wpf.DragDrop.DragDrop.DefaultDropHandler.DragOver(dropInfo); // If you want to keep the default behavior
    }
}
Matthew Olivo
@SaviorXTanren
@timunie Thanks for the info, unfortunately our view model code is in a separate .NET Standard 2.0 project so we can't take a hard dependency on the .NET Framework version in that. Is there anything that can be done directly within the view itself, such as an event that can be subscribed to?
Tim
@timunie
You can also create a new class which implements this interface. You just need to change the binding then.
Matthew Olivo
@SaviorXTanren
That's not really an ideal solution as that'll cause a lot of view model logic to have to get pushed up into the UI project, which I'd like to avoid. I'll think of an idea, thanks for the info!
Tim
@timunie
No this is wrong. It is a few lines of code only.
I'll post a sample in a few minutes
Tim
@timunie
Ok I tested something and it works quite well and tbh I think it will do a good job on your side too.
I made a class like this:
// call it what ever you like, just make sure to imlement IDropTarget.
public class TwoLevelTreeViewDropHandler : IDropTarget
{
    // This can be bound to from anywhere. 
    public static TwoLevelTreeViewDropHandler Instance { get; } = new TwoLevelTreeViewDropHandler();

    public void DragOver(IDropInfo dropInfo)
    {
        // Perform some checks here. 
        if (dropInfo.Data is Pupil pupil && (dropInfo.TargetItem is Class || !dropInfo.InsertPosition.HasFlag(RelativeInsertPosition.TargetItemCenter)))
        {
            GongSolutions.Wpf.DragDrop.DragDrop.DefaultDropHandler.DragOver(dropInfo);
        }
    }

    public void Drop(IDropInfo dropInfo)
    {
        GongSolutions.Wpf.DragDrop.DragDrop.DefaultDropHandler.Drop(dropInfo);
    }
}
And then I can use it in any view like this (notice the second line):
<TreeView x:Name="MyTreeView"
            dd:DragDrop.DropHandler="{Binding Source={x:Static model:TwoLevelTreeViewDropHandler.Instance}}"
            dd:DragDrop.IsDragSource="True"
            dd:DragDrop.IsDropTarget="True"
            dd:DragDrop.UseDefaultDragAdorner="True"
            dd:DragDrop.UseDefaultEffectDataTemplate="True"
            ItemsSource="{Binding Data.Classes}" />
Tim
@timunie
@SaviorXTanren did my idea help you?
Tim Eichfeld
@timeic_gitlab
Hello, I am trying to use the dd:DragDrop.DragHandler="{Binding}", and I can see that CanStartDrag is getting called. I am setting dragInfo.DragEffects to Move, adn returning true, but I am not getting the drag adorner and no drop event. What could I be doing incorrectly?
I am using both the DragHandler and DropHandler. (should I do that?)
Jan Karger ツ ☀
@punker76
@timeic_gitlab Did you set also the IsDragSource and IsDropTarget property?
Tim Eichfeld
@timeic_gitlab
Hi Jan, aye, I did.
Also, full disclosure, I am using a DevExpress GridControl, not just a datagrid, not sure if that matters. I am wondering if some interop is getting in the way, and double checking that how I have it setup on the GS WPF front is correct. My setup is:
dd:DragDrop.IsDropTarget="True"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.DragHandler="{Binding}"
dd:DragDrop.DropHandler="{Binding}"
The reason I want to use the .DragHandler, is because it exposes 'CanStartDrag'. And I need that as I cannot resize columns unless I tell the Drag&Drop to stop on the header or group rows.
Tim Eichfeld
@timeic_gitlab
The behavior I am seeing, is when I have the .DragHandler and the .DropHandler on the same object, the DropHandler.DragOver event is not getting called even though I return true from DragHandler.CanStartDrag
Tim Eichfeld
@timeic_gitlab
OK, So I am guessing that .DragHandler and the .DropHandler are ot supported together. I will have to do a workaround.
Are not supported together that is.
Matthew Olivo
@SaviorXTanren

@timunie sorry, I switched on to some other work for a bit. So this was more what I was looking for initially. So there's one issue I'm encountering still unfortunately with it that. I don't see anywhere in the DragOver method that allows you to not block the drag event from bubbling up. Let me show a picture of the example:

  • I have a window that allows you two have two different drag events on it. If you drag an item type that appears in a list, things work fine and it moves around in the list. If you drag a file on to the window, it'll make a grid visible indicating that a user can do a drag-and-drop with the file and perform an import action when it occurs.

  • When dragging a file into the window, if the mouse cursor makes contact with the window itself first and NOT the list, things work as expected (top image branch). However if you drag the file over quickly and the first drag event triggers on the list, the drop handler will prevent the drag event from bubbling up regardless of whether you call DragDrop.DefaultDropHandler.DragOver(dropInfo) (bottom image branch).

  • If you move the drag back out of the list and have it make contact with the rest of the window, then it works as expected again.

Is there a location I can push that logic in to higher up in the DragDrop stack so that the initial OnDragEnter event that is fired from WPF can not be handled and it can be bubbled up?

image.png
Tim
@timunie
I have no time to test this. But normally you would use the Preview[DragOver, DragEnter, ...]-Event, run your code there and set e.Handled = true; in the event handler.
So I would try to move my file handling there.
Matthew Olivo
@SaviorXTanren

I have no time to test this. But normally you would use the Preview[DragOver, DragEnter, ...]-Event, run your code there and set e.Handled = true; in the event handler.

Sorry for the long delay in response, but that did the track. Thanks for the help :)

Tim
@timunie
:+1: glad to hear :smile:
You are welcome
William-Joshua
@William-Joshua
how to use gong -wpf with itemscontrol and canvas?
Tim
@timunie
@William-Joshua what exactly do you want to achieve? Can you make a sketch or provide a sample App?
danielbanda
@danielbanda
Has anyone done Drag-Drop of Groups (not rows) in a DataGrid using the default CollectionViewSource as grouping mechanism?
Jan Karger ツ ☀
@punker76
@danielbanda No, not yet
JP Garza
@jpgarza93
Has anyone created a Grid based drag drop? Something like Asana's dashboard creator tool in img below
drag and drop, in this case, would look for available columns and rows and change the rowspan and colspan of the items
JP Garza
@jpgarza93
image.png