我正在尝试弄清楚如何通过鼠标拖动来上下移动带有MediaElements的预填充列表框中的项。如果有任何帮助,我将不胜感激。谢谢
发布于 2012-07-31 23:42:56
使用此dll:
xmlns:ex="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"然后,您可以使用交互触发器并在视图模型中调用您的方法。
<i:Interaction.Triggers>
<i:EventTrigger EventName="Drop">
<ex:CallMethodAction TargetObject="{Binding }" MethodName="DocumentListBox_Drop" />
</i:EventTrigger>
</i:Interaction.Triggers>然后在viewmodel中:
Public Sub DocumentListBox_Drop(sender As Object, e As DragEventArgs)
Dim droppedFilePaths As String() = TryCast(e.Data.GetData(DataFormats.FileDrop, True), String())
If Not droppedFilePaths Is Nothing Then
For Each filepath As String In droppedFilePaths
Next
End If
End Sub你应该已经在你的引用列表中有这个dll了,如果没有,你可能不得不在google上寻找它。还请注意:所有这些都比我刚才展示的内容更多,比如确保allowdrop设置为true,等等。
https://stackoverflow.com/questions/11739300
复制相似问题