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

DragAndDrop from RadGridView - tooltip appears when trying to scroll

3 Answers 76 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Aleksander
Top achievements
Rank 1
Aleksander asked on 17 Aug 2011, 09:52 PM
Hey, on RadGridView with scrollbars and DragAndDrop query/info - when I try to scroll - Drag tooltip appears (OnDragQuery) preventing normal scrolling.

e.Options.Source is RadGridView, how to filter scrollbars out of DragDrop when scrolling content of RadGridView?

Thanks,
Alex

3 Answers, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 18 Aug 2011, 09:39 AM
Hi Aleksander,

 You might want to check this help article - http://www.telerik.com/help/wpf/raddraganddrop-disable-drag-when-scrolling.html.

 Let us know if you have any further question or issues regarding this scenario.

Best wishes,
Tsvyatko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Aleksander
Top achievements
Rank 1
answered on 18 Aug 2011, 03:32 PM
Unfortunately, this solution doesn't work.

e.GetElement<System.Windows.Controls.Primitives.ScrollBar>(e.Options.MouseClickPoint)

is always returning null for RadGridView in OnDragQuery

I wrote a workaround myself:

private bool IsScrollBarHit(Visual reference, Point pt)
        {
            var htr = VisualTreeHelper.HitTest(reference, pt);
            var parent = htr.VisualHit;
            while(parent != null && !parent.GetType().Equals(typeof(System.Windows.Controls.Primitives.ScrollBar)))
            {
                parent = VisualTreeHelper.GetParent(parent);
            }
            return parent != null;
        }

and use it in OnDragQuery as:
var pt = YOURRADGRIDVIEW
                .TransformToAncestor(YOURMAINWINDOW)
                .Transform(new Point(0, 0));

            var relPoint = new Point(e.Options.MouseClickPoint.X - pt.X, e.Options.MouseClickPoint.Y - pt.Y);

if (IsScrollBarHit(YOURRADGRIDVIEW, relPoint))

{
e.QueryResult = false;
return;
}

//if (e.GetElement<System.Windows.Controls.Primitives.ScrollBar>(e.Options.MouseClickPoint) != null)
//{
//    e.QueryResult = false;
//    return;
//}

Please check your e.GetElement<T> if it works correctly with RadGridView
Alex
0
Tsvyatko
Telerik team
answered on 23 Aug 2011, 12:23 PM
Hi Aleksander,

 Thank you for sharing this. We will definitively check our code for any issues. Would it be possible to share with us any specifics of the scenario in which the problem occurs - Using element hosts, main window styles applied or popups used.

Kind regards,
Tsvyatko
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
DragAndDrop
Asked by
Aleksander
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Aleksander
Top achievements
Rank 1
Share this question
or