Ticket Q468723
Visible to All Users

TreeList - How to obtain a drag-and-drop icon during the DragOver event

created 11 years ago

[Extracted from the How to change XtraTreeList drag-and-drop icons ticket ]

This event only fires when a Node is about to be dragged. I would like to be able to change the icons based on the Drag Node AND the Drop Node in the DragOver event. Is this possible?

Comments (3)
DevExpress Support Team 11 years ago

    Hello,
    I have tested this approach and on my side this event fires on each mouse move. Please check the attached project and video, and modify the project to illustrate your scenario. I am looking forward to your response.

      Sorry for my incorrect statement. Yes the CalcNodeDragImageIndex fires everytime, but if I was able to change the Image via the DragOver event I have access to both the Drag Node and the Target Node. I believe the CalcNodeDragImageIndex only provides access to the DragNode?
      What I am building is functionality to enable a Grid Layout to be built using a TreeList view of the Grid… ie nodes representing Bands and Columns from the Grid. Obviously there are rules as to where a Grid Column can exist… for example it cannot exist under a Band which has child bands… so I am testing for this in the Drag Over event and setting the e.Effect to None or Move and want to be able to set the DragNodeImageIndex at the same time.
      So I am not saying there is a bug or issue, just that I would like to be able the set the DragImageIndex during the DragOver event where I am testing the dragdrop conditions…
      I have provided a screen snapshot of my function currently working (except for node images…)
      Cheers
      Jeff

      DevExpress Support Team 11 years ago

        Hello,
        It is possible to obtain both the target and drag nodes. You can obtain the target node from the e.Node property and drag the node from e.DragArgs as follows:

        Visual Basic
        Dim node As TreeListNode = CType(e.DragArgs.Data.GetData(GetType(TreeListNode)), TreeListNode)

        So, you can change a drag image in this event handler based on your own logic.
        I hope this helps. Should you have any further questions, feel free to contact me at any time.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.