This is a migrated thread and some comments may be shown as answers.

cancel selected node change when drag and drop

14 Answers 347 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
steve
Top achievements
Rank 1
steve asked on 09 Apr 2010, 08:50 PM
I have a treeview that when a node is selected filters items in a radpanel bar.  The rad panel bar also excepts nodes dragged to it by the treeview.  However, I am at a lose for how to prevent the selectednodechaged event from firing the filter method if drag is true.  In the NodeMouseMove event I set the IsDrag variable to true and the filter does not fire.  However, that only works once because I cannot figure out a way to set the varibale to false after the drag is complete.  DragEnd And DragStart do not fire when dragging out of the treeview. 

Here is the code
             private void SelectorRadTreeView_SelectedNodeChanged(object sender, RadTreeViewEventArgs e)  
        {  
            if (!IsDrag)  
                OnFilterGoals(this);  
        }  
private void SelectorRadTreeView_NodeMouseDown(object sender, RadTreeViewMouseEventArgs e)  
        {  
            if (sender != null)  
            {  
               RadTreeView myTree = sender as RadTreeView;  
               myTree.DoDragDrop(myTree, DragDropEffects.Copy);  
               IsDrag = true;  
            }  
        }  
        private void SelectorRadTreeView_DragEnded(object sender, RadTreeViewDragEventArgs e)  
        {  
            IsDrag = false;  
        }  
 
        private void SelectorRadTreeView_DragEnding(object sender, RadTreeViewDragCancelEventArgs e)  
        {  
            IsDrag = false;  
        } 

14 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 14 Apr 2010, 02:47 PM
Hello steve,

Thank you for writing.

You can use the SelectedNodeChanging event and set the Cancel property of the tree view arguments to the value of your drag flag.

Best wishes,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
steve
Top achievements
Rank 1
answered on 14 Apr 2010, 10:48 PM
Thanks Victor, but that always prevent the filter event from firing.  Here is what I had to do.

        private void SelectorRadTreeView_NodeMouseDown(object sender, RadTreeViewMouseEventArgs e)  
        {  
            if (e.OriginalEventArgs.Button.Equals(MouseButtons.Left))  
            {  
                _draggedNode = e.Node;  
            }  
        }  
        private void SelectorRadTreeView_MouseUp(object sender, MouseEventArgs e)  
        {  
            _draggedNode = null;  
        }  
        private void SelectorRadTreeView_MouseMove(object sender, MouseEventArgs e)  
        {  
            if (e.Button.Equals(MouseButtons.Left))  
            {  
                RadTreeView myTree = sender as RadTreeView;  
 
                //Point screenLocation = myTree.PointToScreen(e.Location);  
                if (_draggedNode != null)  
                {  
                    myTree.DoDragDrop(_draggedNode, DragDropEffects.Move);  
                    //_draggedNode = null;  
                }  
            }  
        }  
        private void SelectorRadTreeView_NodeMouseUp(object sender, RadTreeViewMouseEventArgs e)  
        {  
            if (e.Node.Equals(_draggedNode))  
            {  
                DataRowView selectorRowView = (DataRowView)SelectorRadTreeView.SelectedNode.DataBoundItem;  
                Id = int.Parse(selectorRowView.Row[ID].ToString(), CultureInfo.InvariantCulture);  
                OnFilter(this);  
                _draggedNode = null;  
            }  
        } 
0
steve
Top achievements
Rank 1
answered on 15 Apr 2010, 05:27 PM
I am still having an issue with the drag.  Dragging from the treeview control works fine, however, when I drag the item over the grid view I wan to drop it on, it doesn't fire the drop event.  The drag enter event fires but I the data doesn't drop into the drop event.  I have the grid set to allow drop and it was working fine before I change the tree events to allow the filter to fire. 

I have other grids in my app and the drop icon appears when I hover over them (grid to grid).  When I drag from the treeview to any of those grids, I do not get the icon.  I also noticed that when I drag to the grid the treeview is supposed to drop on from another grid I do not the icon either. 

The grid the treeview is supposed to drop on is inside a radpanelbar with the outlook style.  Is there anything about this style that would prevent the drop from firing?
0
Victor
Telerik team
answered on 16 Apr 2010, 05:24 PM
Hi steve,

The issue you are describing is probably due to mixing standard OLE Drag & Drop events and the events that RadTreeView provides.

RadTreeView's events are these:

  • DragEnded
  • DragEnding
  • DragOverNode
  • DragStarted
  • DragStarting
  • ItemDrag

The OLE events are these:

  • DragDrop
  • DragEnter
  • DragLeave
  • DragOver
  • GiveFeedback
  • QueryContinueDrag

Also there are drag & drop related properties declared in Control and different ones declared in RadTreeView.

RadTreeView:

  • AllowDragDrop
  • AllowDragDropBetweenTreeViews
  • AutoScrollOnDragDrop
  • DropFeedbackColor


Control:

  • AllowDrop


You must use only the OLE events if you want to drag and drop between any control. For dragging and dropping between RadTreeViews, you can use either RadTreeView's events or the OLE events, just choose one set of events and use it exclusively.
Write again if you need further assistance.

Regards,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
steve
Top achievements
Rank 1
answered on 16 Apr 2010, 06:16 PM
Thanks Victor.  I thought that might be the case. 
0
steve
Top achievements
Rank 1
answered on 16 Apr 2010, 07:19 PM
Looks like my problem was  DragDropEffects.Copy was set to DragDropEffects.Move.  I guess somewhere I switched the code and since the data was transerfering to the grid, I never suspected Move was incorrect. 
0
Accepted
Victor
Telerik team
answered on 19 Apr 2010, 04:55 PM
Hi steve,

It is great that you spotted this issue, we are ready to assist you should you need further assistance.
 
Regards,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
steve
Top achievements
Rank 1
answered on 27 Apr 2010, 06:24 AM
I noticed a weird problem with the radtreeview.  If you expand the treeview one node passed the horizontal scrolls the mouse up does not fire.  Is this a know issue?
0
Dobry Zranchev
Telerik team
answered on 27 Apr 2010, 03:24 PM
Hello steve,

Thank you for writing. Unfortunately, I could reproduce that issue. Could you provide a sample that reproduce it (you will need to open a new support ticket) and/or send us the steps in order to verify that issue?

All the best,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
steve
Top achievements
Rank 1
answered on 27 Apr 2010, 05:01 PM
ok, should have it by this after noon.
0
steve
Top achievements
Rank 1
answered on 28 Apr 2010, 01:07 AM
Each time I try to submit a support ticket, it only allows mt to submit a ticket for ASP.net Ajax and some other product.  Is there something wrong with the site?
0
Donna
Telerik team
answered on 29 Apr 2010, 10:20 AM
Hello Steve,

It seems there has been a temporarily glitch in our system, which is why your account has not been showing correct support ticket options. Please accept our apologies for any incontinence this error might have caused. The problem has been fixed already and you should not have any problems submitting a ticket for the correct product line.

If I can be of any additional assistance, please let me know.
 
Best wishes,
Donna
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
steve
Top achievements
Rank 1
answered on 29 Apr 2010, 04:39 PM
Thanks, Donna! The ticket was submitted thanks.
0
Donna
Telerik team
answered on 05 May 2010, 12:36 PM
You are very welcome, Steve! I'm glad I could help. :)

All the best, Donna
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Treeview
Asked by
steve
Top achievements
Rank 1
Answers by
Victor
Telerik team
steve
Top achievements
Rank 1
Dobry Zranchev
Telerik team
Donna
Telerik team
Share this question
or