I have a ListView that I need to function as a drop target. I have added the following trigger
<i:Interaction.Triggers>
<i:EventTrigger EventName="Drop">
<i:InvokeCommandAction Command="{Binding ItemsDroppedCommand}"
CommandParameter="{Binding ???}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
The problem is though I dont know how to get the dropped items. What should go in the CommandParameter binding?
If I do a drop handler in code behind I get a DragEventArgs parameter that enables me to get the files dropped. Is there a way to get this?
If this is the wrong approach please feel free to suggest alternatives
Passing an event's arguments to a Command through binding isn't supported out of the box but can be achieved through a workaround.
However, I would recommend you to use the EventToCommand behavior available in MVVM Light, which enables exactly this scenario:
<i:Interaction.Triggers>
<i:EventTrigger EventName="Drop">
<cmd:EventToCommand Command="{Binding ItemsDroppedCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
please take a look on this thread MVVM Passing EventArgs As Command Parameter
In this thread will help you solve the problem. I hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With