MVVM交互丢弃触发
我有一个 ListView,我需要将其用作放置目标。我添加了以下触发器
<i:Interaction.Triggers>
<i:EventTrigger EventName="Drop">
<i:InvokeCommandAction Command="{Binding ItemsDroppedCommand}"
CommandParameter="{Binding ???}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
问题是虽然我不知道如何获取掉落的物品。 CommandParameter 绑定中应该包含哪些内容?
如果我在后面的代码中执行放置处理程序,我会得到一个 DragEventArgs 参数,该参数使我能够放置文件。有办法得到这个吗?
如果这是错误的方法,请随时提出替代方案
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不支持开箱即用地通过绑定将事件参数传递给命令,但可以通过解决方法。
但是,我建议您使用 MVVM 中提供了 rel="nofollow">EventToCommand 行为Light,它恰好实现了这种场景:
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:
请查看此线程 MVVM Passing EventArgs As Command Parameter
在此线程中将帮助您解决问题。
我希望这有帮助。
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.