gpt4 book ai didi

mvvm - 如何使用silverlight将xaml中的drageventArgs作为命令参数进行引用

转载 作者:行者123 更新时间:2023-12-03 10:18:52 25 4
gpt4 key购买 nike

在我的silverlight 4应用程序上,我试图将列表框上的drop事件链接到我的viewmodel。我正在使用Expression Blend 4的事件触发器和invokecommandaction来挂接drop事件。在我的 View 模型上设置断点,当我将文件拖到列表框中时,可以看到触发了相关功能,但是似乎无法访问drageventArgs。我尝试将整个列表框作为命令参数发送,但这不起作用。

有任何想法吗?

谢谢

最佳答案

目前,我正着眼于这个问题。经过一番研究,我发现了这个http://www.silverlightshow.net/news/Silverlight-Commands-Hacks-Passing-EventArgs-as-CommandParameter-to-DelegateCommand-triggered-by-EventTrigger-.aspx

因此,与此同时,我决定使用MVVM Light的EventToCommand类,该类类似于InvokeCommandAction,但允许您将事件args作为命令参数传递。 (http://www.galasoft.ch/mvvm/getstarted/)

-似乎工作正常

<i:Interaction.Triggers>
<i:EventTrigger EventName="Drop">
<infra:EventToCommand PassEventArgsToCommand="True"
Command="{Binding Path=LinkOrderCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>

关于mvvm - 如何使用silverlight将xaml中的drageventArgs作为命令参数进行引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2818453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com