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

Scrollbar & Drag&Drop

2 Answers 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ludovic Alcala
Top achievements
Rank 1
Ludovic Alcala asked on 26 Mar 2010, 10:53 AM
Hello,
when i scroll in my radgridview, i cannot block the drag of my elements.
I manage my dragged elements by RadDragAndDropManager like that :

ctor()
{
RadDragAndDropManager.AddDragQueryHandler(ListingProductGridView, OnRadGridViewDrag);
RadDragAndDropManager.AddDragInfoHandler(ListingProductGridView, OnRadGridViewDragInfo);
}



and in events :
private void OnRadGridViewDragInfo(object sender, DragDropEventArgs e)
        {
            RadGridView gridView = sender as RadGridView;
            IEnumerable draggedItems = e.Options.Payload as IEnumerable;
            if (e.Options.Status == DragStatus.DragInProgress)
            {
                TreeViewDragCue cue = new TreeViewDragCue();
                cue.ItemTemplateSelector = new ProductCategoryTemplateSelector() { MySize = ProductCategoryTemplateSelector.Size.Large };
                cue.ItemsSource = draggedItems;
                e.Options.DragCue = cue;
            }
            else if (e.Options.Status == DragStatus.DragComplete)
            {
                // Fin d'opĂ©ration de dragging

            }
        }
        private void OnRadGridViewDrag(object sender, DragDropQueryEventArgs e)
        {
            RadGridView gridView = sender as RadGridView;
            if (gridView != null)
            {
                IList selectedItems = gridView.SelectedItems.ToList();
                e.QueryResult = selectedItems.Count > 0;
                e.Options.Payload = selectedItems;
                e.QueryResult = true;
                e.Handled = true;
            }

        }


 But when i scroll, i have my dragged items on the scrollbar, can i block that ?

Thank you.





2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvyatko
Telerik team
answered on 29 Mar 2010, 09:24 AM
Hi Ludovic Alcala,

Please check the attached project. It demonstrates how to avoid dragging when performing scroll. The idea is to get the element below the mouse when the drag starts. It can be achieved using the following code:
if (e.Options.Status == DragStatus.DragQuery)
{
    e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue();
    var element = e.GetElement<ScrollBar>(e.Options.MouseClickPoint);
    e.QueryResult = e.QueryResult.Value && element == null;
}


Regards,
Tsvyatko
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
Ludovic Alcala
Top achievements
Rank 1
answered on 29 Mar 2010, 09:31 AM
Thank you, it works :)
Tags
GridView
Asked by
Ludovic Alcala
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Ludovic Alcala
Top achievements
Rank 1
Share this question
or