Hi,
I have a small application that allow user to drag and drop between each TextBlock. If a text is dragged to another TextBlock, the drag source will remove its content. It works fine until I want to drag to an empty TextBlock (which had something inside before but got dragged out). The cursor turned to cross and it did not allow to drop there anymore. Would you please let me know if there is any special setting to make it happen? I already placed DragSource and DropTarget within the TextBlock, DragChannels and DropChannels were the same.
Thanks in advance.
Hello Tangailam,
Thank you for your post.
I have been looking into it. I created a sample application(DropBack.zip) based on your scenario and I could not managed to reproduce the behavior that you have described. In the sample application I created three TextBlock and to achieve the functionality that you are looking for I added DropTarget object and DragSource object to each TextBlock and handled the Drop event for each one. In the events handlers I get the element that will be dragged and other that is container for it.
If you are not able to reproduce the issue with the attached sample application, would you please modify it with the functionality, that you are using, so it reproduces the issue. This way I would be able to further investigate this for you and provide you with more detailed information on this matter.
You can read more details about our Drag and Drop Framework from online documentation from the following link:
http://help.infragistics.com/doc/WPF/2014.2/CLR4.0/?page=Drag_and_Drop_Framework_Getting_Started_with_IG_Drag_and_Drop_Framework.html
Looking forward to hearing from you.
Hi Zhivko,
Thank you for your sample application. It worked well but unfortunately did not solve my problem. I have updated your sample with my code, please see attached and let me know.
Thanks.
Thank you for your reply.
I have been looking into in and the modified sample application that you have provided. I am not completely sure that I understand correctly what you try to achieve.
Would you please provide me with more details about it?
If I understand your requirement correctly you want to use Drag and Drop functionality for each custom DropableTextBlock. Do you want to be able to handle the text from one DropableTextBlock and move it to other DropableTextBlock? Should the text from first DropableTextBlock to be visible in the second one and to be able to drag the text to first one again? If is it you can adding DropTarget object and DragSource object to your DropableTextBlock instead of TextBlock in UserControl.
I modified the sample application to show you how you can implement this. Please let me know if I missing something from your scenario.
Please let me know if you need any further assistance on the matter.
Thank you for the new sample. Please allow me to clarify a little bit about my scenario: My screen has at least 16 TextBlock and a ListBox. Their content will be draggable back and forth. DropableTextBlock was created because I don't want to add DropTarget and DragSource to each and every TextBlock.
To answer your questions:
- Yes, I want to drag text from one DropableTextBlock and move to another one.
- Yes, the text should transfer back and forth.
In your modified sample, I can see that you added DragSource and DropTarget to every DropableTextBlock. This is something I am trying to avoid. Is it possible to just add DragSource and DropTarget inside UserControl only and handle everything from there? This might save some time and the code will be easily maintained.
Hello Hieu,
I am very glad that my support was helpful for you. If you require any further assistance on the matter, please do not hesitate to ask.
Thank you very much for your time Zhivko. Your latest sample helped me solve the problem. I really appreciate your time and effort for this issue even though it does not relate to Infragistics Drag and Drop Framework. Great job!
I have been investigating further your issue. It seems that it is caused by default width of the TextBlock. When drag text from one DropableTextBlock to other and set the first one to empty string, the width of TextBlock is resized to zero, so you cannot drag in it anymore. You can set the MinWidth property of TextBlock in your UserControl to be able to drag text to the TextBlock anytime. I modified the last sample application to show you how you can implement the functionality that you are looking for.
Please let me know if you need any further assistance eon the matter.