treeview is not visible when it's a drop target

Jun 24, 2009 at 3:23 PM

hi kev,

I want to drag and drop leaves from one tree to another. The problem is that if I put my treeview inside a Droptarget, it won't be visible, only the outline of the drop area is visible when an object is dropped.

My XAML:

            <controls:TreeView x:Name="FromTree" ItemsSource="{Binding Source={StaticResource model}, Path=Data}">
                <controls:TreeView.ItemTemplate>
                    <win:HierarchicalDataTemplate x:Key="PersonTemplate" ItemsSource="{Binding Children}">
                        <StackPanel Orientation="Horizontal">
                            <dragdrop:DragSource x:Name="fromDragSource" AllDropTargetsValid="True" GhostVisibility="Visible" DropMode="ReturnDragSource">
                                <TextBlock Text="{Binding Name}" />
                                <dragdrop:DragSource.Ghost>
                                    <TextBlock Text="{Binding Name}"/>
                                </dragdrop:DragSource.Ghost>
                            </dragdrop:DragSource>                           
                        </StackPanel>

                    </win:HierarchicalDataTemplate>
                </controls:TreeView.ItemTemplate>
            </controls:TreeView>
            <dragdrop:DropTarget DragSourceDropped="DropTarget_DragSourceDropped" >
                <dragdrop:DragSource>
                    <controls:TreeView x:Name="ToTree">
                    </controls:TreeView>
                </dragdrop:DragSource>
            </dragdrop:DropTarget>

Thanks.

Coordinator
Jun 24, 2009 at 3:57 PM

Hi,

have you tried giving the dragsource/droptarget a fixed width?

 

Regards,
Kev. 

Jun 25, 2009 at 11:30 AM

Hi,

I tried it, and the drop area has now the proper size, but the treeview is still not visible.

Regards.