我试图弄清楚如何通过鼠标拖动来上下移动带有 MediaElements 的预填充列表框中的项目。我将不胜感激任何帮助。谢谢
问问题
566 次
1 回答
0
使用这个 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>
然后在视图模型中:
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,如果没有,你可能需要在谷歌上寻找它。另请注意:除了我刚刚向您展示的内容之外,还有更多内容,例如确保将 allowdrop 设置为 true 等等。
于 2012-07-31T15:42:56.200 回答