Hi.
I have looked at the following post but it is not doing what I want.
http://es.infragistics.com/community/forums/p/72171/365708.aspx#365708
I am trying to allow nodes in a XamDataTree, either parent or child to be dragged to another control, such as a standard WPF ListBox. So far we have tried:
HI,
I am attaching a sample that drags a treenode to a usercontrol containing a listbox.
Please review my sample.
As I mentioned in my post I looked at this example which was provided by the link but it does not work correctly as it does not have the context of the node.
Hi
I need to have Drag and Drop functionality between a XamDataTree and another control (e.g. ListBox) in both directions as well as WITHIN the XamDataTree.
When playing with the sample provided in this thread i could always get some of the dragging working but not all of them.
Would it be possible to extend this demo so that dragging is enabled in both ways and also within the tree?
Thanks,
Hello Ofer,
Thank you for your post. I have been looking into it and I modified the sample Matt uploaded, so now it has the functionality you want. Basically I created an ItemTemplate for the ListBox and make the TextBlock inside draggable. This way I was able to drag it and drop it in the XamDataTree. I also add a check in the XamDataTree's NodeDrop event handler to see if the DropTarget is ListBox and if not I let the XamDataTree make its built in DragDrop of Nodes.
I'm trying to do basically the same thing, only dragging a node from a XamDataTree to a XamTextEditor. Sample program works. The XamDataTree_NodeDragDrop doesn't fire (unless I enable and drag and drop within the XamDataTree, which I don't want). Here is my xaml:
<igEditors:XamTextEditor x:Name="txtProducedByFermentation" Margin="2" Height="24" Width="150" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalContentAlignment="Center" AllowDrop="True"/>
<ig:XamDataTree Grid.Row="0" Grid.Column="2" HorizontalAlignment="Stretch" MinWidth="200" Grid.RowSpan="7" VerticalAlignment="Top" ItemsSource=" {Binding AttributeViewModels}" NodeDragDrop="XamDataTree_NodeDragDrop"><ig:XamDataTree.GlobalNodeLayouts> <ig:NodeLayout Key="ChildAttributes" TargetTypeName="AttributeViewModel" DisplayMemberPath="AttributeID" IsExpandedMemberPath="AttributeIsExpanded" IsDraggable="True" IsDropTarget="False"/> </ig:XamDataTree.GlobalNodeLayouts> </ig:XamDataTree>
Any help is appreciated.
I think I've got it working... I added a DropTarget object to each of my text boxes and that seems to have fixed the majority of issues. Note that at this point, my XamDataTree does NOT have a DropSource object.
There is still an issue I'd like to resolve: I'd like to change the mouse cursor from the red "X" whenever a list item has been dragged over a valid text editor. At this point, the cursor remains "X".
Thanks.
Working xaml:
<igEditors:XamTextEditor x:Name="txtProducedByFermentation" Text="{Binding Attribute1}" Margin="2" Height="24" Width="150" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalContentAlignment="Center" AllowDrop="True">
<ig:DragDropManager.DropTarget>
<ig:DropTarget IsDropTarget="True"/> </ig:DragDropManager.DropTarget> </igEditors:XamTextEditor>
Hello,
Thank you for your post. I have been looking into it and I can suggest you see the sample in the Samples Browser under Drag and Drop Framework / Style / Custom Cursors section, where it is shown how to apply custom cursor. Also here you can read more about this:
http://help.infragistics.com/Help/Doc/WPF/2012.1/CLR4.0/html/Infragistics_Drag_and_Drop_Framework_Set_Custom_Cursors_for_Different_Drag_and_Drop_Situations.html
Please let me know if you have further questions on this matter.
Looking forward for your reply.
Hello Seth,
I have been looking into Matt's sample and I modified it, so now it works as you want. Basically I created a separate Drag and Drop using Infragistics DragDrop Framework. Please note that this way the built in drag and drop of the XamDataTree won't work. If you want to be able to reorganize the nodes inside the data tree you have to create your own drag drop functionality.
Hi Stefan,
Here's a video capture of the Infragistics demo program (WpfApplication191) provided at the top of this thread by Matt. It shows the same behavior I'm seeing. Note that I'm on 12.2 at this time.
http://screencast.com/t/2sAL30tuwXS
Thank you.
Seth
By default there is a "plus" cursor when you hover over a valid drop target, so I assume there is some issue with your drag and drop logic. If you send me a sample project where this is reproducible I would be able to investigate it further for you.
I have reviewed the sample and the documentation. Both provide information as to how set custom cursors. The problem I seem to be having is the cursor is not changing, whether customized or not, when I drag a tree node over the XamTextEdit target. Do I need to set a custom cursor to achieve the behavior I'm looking for? Is there not a standard cursor that appears when hovering over a drop target?
Below is a link to a short video demonstrating what I'm seeing. Note that the standard drag cursor does not change when hovering over the drop target.
http://screencast.com/t/Of4B23kZi