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

Expand on drag over delay

2 Answers 52 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jamest
Top achievements
Rank 2
Jamest asked on 21 Aug 2009, 07:38 PM
I didn't see a property for this anywhere or any other mention in the forums so I thought I would provide my work around. This was desired for me because when dragging over a deep tree the user can instantly get overwhelmed with expanding branches quickly putting there original desired target out of view. If there are better ways to handle this please share.

        private RadTreeViewItem cCurrentItemDelayExpand = null;  
        private int cCurrentItemHitCount = 0;     
        private void myTreeView_PreviewExpanded(object sender, RadRoutedEventArgs e)  
        {  
            if (RadDragAndDropManager.IsDragging)  
            {  
                if (e.Source is RadTreeViewItem)  
                {  
                    if (cCurrentItemHitCount > 999) cCurrentItemHitCount = 0;  
                    if ((RadTreeViewItem)e.Source == cCurrentItemDelayExpand)  
                    {  
                        if (cCurrentItemHitCount++ < 7)//adjust the number to fine tune your desired "delay" hit count  
                            e.Handled = true;  
                    }  
                    else 
                    {  
                        cCurrentItemDelayExpand = (RadTreeViewItem)e.Source;  
                        cCurrentItemHitCount = 0;  
                        e.Handled = true;  
                    }  
                }  
            }  
        } 

2 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav
Telerik team
answered on 26 Aug 2009, 12:25 PM
Hello Ender,

Thank you for sharing your workaround, I like how it is done with very little code!

This is not the first time we see the need for expand delay and a property to control this will appear in this week's internal build (28.Aug and onwards), the name of the property is DropExpandDelay and it defaults to 1 second.

Hopefully with your feedback, we will be able to make workarounds like this one unnecessary,

Regards,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jamest
Top achievements
Rank 2
answered on 26 Aug 2009, 02:02 PM
This is great!!! As my work around is dependent on minute mouse movement, rather than time based. Looking forward to supported implementation!

           Thanks,
              Jordan
Tags
TreeView
Asked by
Jamest
Top achievements
Rank 2
Answers by
Miroslav
Telerik team
Jamest
Top achievements
Rank 2
Share this question
or