[SOLVED] TreeView doesn't honour AllowDrag

Answered Closed
0
0

I attach a dual sample (Winforms/Wisej) solution to show the issue. The Drag&Drop code is the same on both samples, except for the DropTarget Wisej nice innovation.

It’s a simple move-nodes-around sample that shows the issue on a MessageBox showing that AllowDrag is set to true, followed by an error message box saying “Dragging not allowed when AllowDrag is false.”

The same Wisej sample can be used to test the issue TreeViewNode – Can’t set OpenedImageIndex nor SelectedImageIndex. On MainForm.Designer.cs, uncomment the lines

<TreeNode>.SelectedImageIndex = 3;
<TreeNode>.OpenedImageIndex = 3;

Attachment
  • You must to post comments
Best Answer
0
0

Hi Tiago,

The problem is that you are initiating the drag operation on the form. Change the test code to “tv.DoDragDrop(…). The sample otherwise works well.

AllowDrag is a new property and it allows a control to start a drag operation. Otherwise the framework on the client would have to start listening to and generating drag events for all controls to detect when the  mouse is dragged.

WinForms could do it since it’s running on the client. VWG forced to you setup a list of target, effectively getting the concept of drag & drop at the opposite.

Best,

Luca

  • You must to post comments
0
0

Everything is fixed as you suggested, on both samples. I attach a fully working sample where you can rename the nodes as well (<F2> type the changes and commit the changes with <Enter>).

Of course you can reuse the sample on the documentation.

Attachment
  • You must to post comments
0
0

Thank you. Will check and log. The icon issue is fixed.

  • You must to post comments
Showing 3 results