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

Disabling ScrollViewer Drag Trigger

1 Answer 106 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Matan
Top achievements
Rank 1
Matan asked on 04 Sep 2014, 02:39 PM
Hi !

I have a RadGridView with attached OnDragInitialize event handler.
When I try to scroll the gridview's scrollviewer then the event is triggered.
How may I disable this?

I've tried this solution:
public void Rad_OnDragInitialize(object sender, Telerik.Windows.DragDrop.DragInitializeEventArgs e)
        {
            RadGridView itemsControl = (RadGridView)sender;
            ScrollViewer scroll = UIHelpers.GetScrollViewer(itemsControl) as ScrollViewer;
            GridViewVirtualizingPanel presenter = UIHelpers.GetItemsPresenter(itemsControl);
             
            if (presenter != null && scroll != null && scroll.IsMouseOver && !presenter.IsMouseOver)
            {
                return;
            }
.............

The event isn't triggered anymore but the scrollviewer won't move at all.

thanks,
Idan

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 04 Sep 2014, 03:42 PM
Hello Matan,

You have set AllowDrag to the whole RadGridView instead of just the Rows. You have to set AllowDrag to true on the rows only.
<Style TargetType="telerik:GridViewRow"
                   x:Key="DraggedRowStyle">
                <Setter Property="telerik:DragDropManager.AllowDrag"
                        Value="True" />
            </Style>


This will take care of the problem of ScrollViewer trying to start the drag.

Hope this makes sense. 

Regards,
Nik
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
DragAndDrop
Asked by
Matan
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or