Disabling ScrollViewer Drag Trigger

2 posts, 0 answers
  1. Matan
    Matan avatar
    5 posts
    Member since:
    Aug 2014

    Posted 04 Sep 2014 Link to this post

    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
  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 04 Sep 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top