我已经创建了一个像这样的TreeViewDragDropTarget,
<controlsToolKit:TreeViewDragDropTarget msWindows:DragDrop.AllowDrop="False" ItemDroppedOnTarget="TreeViewDragDropTarget_ItemDroppedOnTarget" ItemDragCompleted="TreeViewDragDropTarget_ItemDragCompleted" AllowedSourceEffects="Copy">
<controlsToolKit:TreeViewDragDropTarget.Resources>
<common:HierarchicalDataTemplate x:Key="hierarchicalTemplate" ItemsSource="{Binding ChildNode}">
<TextBlock Text="{Binding MainText, Mode=TwoWay}" TextWrapping="Wrap"/>
</common:HierarchicalDataTemplate>
</controlsToolKit:TreeViewDragDropTarget.Resources>
<controls:TreeView x:Name="MainTreeView" BorderThickness="1" ItemTemplate="{StaticResource hierarchicalTemplate}" Background="Transparent" Cursor="Hand" BorderBrush="{x:Null}" VerticalAlignment="Top"/>
</controlsToolKit:TreeViewDragDropTarget>
All I am doing is dropping some text into the nodes of the treeview. I want to find the parent node of the drop target. How do I do it?
答案 0 :(得分:1)
请查看此帖子。您需要使用treeview控件的Drop事件。 http://forums.silverlight.net/forums/p/190196/439403.aspx