Hi! I'm using prism in my application and I was wondering if there is anyway to use the drag and drop framework to drag items between to different modules.
Module 1 Module 2
View A - ViewModel A => View B - Viewmodel B
In View A I have a datatemplate that implements the following:
<ig:DragDropManager.DragSource > <ig:DragSource IsDraggable="True" DragChannels="ChannelA"> <i:Interaction.Triggers> <i:EventTrigger EventName="DragStart"> <!-- ReSharper disable once Xaml.BindingWithContextNotResolved --> <local:InvokeDelegateCommandAction Command="{Binding Source={x:Reference DataTreeRootGrid}, Path=DataContext.OnDragStartCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"/> </i:EventTrigger> <i:EventTrigger EventName="DragEnter"> <!-- ReSharper disable once Xaml.BindingWithContextNotResolved --> <local:InvokeDelegateCommandAction Command="{Binding Source={x:Reference DataTreeRootGrid}, Path=DataContext.OnDragEnterCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"/> </i:EventTrigger> <i:EventTrigger EventName="DragLeave"> <!-- ReSharper disable once Xaml.BindingWithContextNotResolved --> <local:InvokeDelegateCommandAction Command="{Binding Source={x:Reference DataTreeRootGrid}, Path=DataContext.OnDragLeaveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"/> </i:EventTrigger> <i:EventTrigger EventName="Drop"> <!-- ReSharper disable once Xaml.BindingWithContextNotResolved --> <local:InvokeDelegateCommandAction Command="{Binding Source={x:Reference DataTreeRootGrid}, Path=DataContext.OnDropCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"/> </i:EventTrigger> <i:EventTrigger EventName="DragOver"> <!-- ReSharper disable once Xaml.BindingWithContextNotResolved --> <local:InvokeDelegateCommandAction Command="{Binding Source={x:Reference DataTreeRootGrid}, Path=DataContext.OnDragOverCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}"/> </i:EventTrigger> </i:Interaction.Triggers>
</ig:DragSource> </ig:DragDropManager.DragSource>
<ig:DragDropManager.DropTarget> <ig:DropTarget IsDropTarget="True" DropChannels="ChannelA"/>
</ig:DragDropManager.DropTarget>
I am able to drag and drop within this View A (which is intended). I am unclear how to enable the "Drop" event in Module B. (Via WPF I'd just set a control to "AllowDrop = true" and hook up to it's Drop event.) Is there someway to do this using your framework?
Regards,
Nathan
Hello Nathan,
I would imagine you would need add ChannelB as DragChannels too as demonstrated in our online documentation:
https://ko.infragistics.com/help/wpf/drag-and-drop-framework-set-drag-and-drop-channels
Have you tried this without using Prism, and does it work?
Let me know if you have any questions.