2
我想弄清楚如何通過鼠標拖動上下移動MediaElements的預填充列表框中的項目。我將不勝感激任何幫助。由於在WPF中拖放ListBoxItems
我想弄清楚如何通過鼠標拖動上下移動MediaElements的預填充列表框中的項目。我將不勝感激任何幫助。由於在WPF中拖放ListBoxItems
有了這個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等等。
我建議你查看[Bea Stollnitz關於拖放數據綁定項目的文章](http://bea.stollnitz.com/blog/?p=53) – Rachel 2012-07-31 15:35:57