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

Auto Scroll while dragging a row

14 Answers 196 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Voss Grose
Top achievements
Rank 1
Voss Grose asked on 26 Jul 2009, 04:12 PM
Any idea if of a way to auto scroll a GridView either up or down while a user is dragging a row?

Basically if a user is dragging a row down and gets near the last visible row I would like to start auto scrolling the grid down for them so they do not have to use the mouse wheel.

Thanks,
Voss.

14 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 28 Jul 2009, 06:26 AM
Hello Voss Grose,

Thanks for your feedback. We will add this feature with some future release.
For now the only option is to use mouse wheel.
Do not hesitate to write back if you have more feature requests.

Greetings,
Hristo
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
Karan
Top achievements
Rank 1
answered on 06 Dec 2011, 04:27 PM
Hello  Hristo, 

Is this feature available in Q3_2101 for WPF Gridviews ? ...
0
Madhu
Top achievements
Rank 1
answered on 08 Dec 2011, 06:29 AM
Is there a way to add more rows to the grids as user scrolls down using mouse or scroll bar. We would like to eliminate multiple pages of the grid and using one page and dynamically load the rows as user scrolls.

Regards,
Madhu
0
Dan
Top achievements
Rank 1
answered on 20 Dec 2011, 10:12 PM
Hi Tech Support,

Has this feature released yet?  It's hard for them to reordering rows from row 1 to row 100 while gridview has only 20 rows and vertical scrollbar.

-Don
0
Nick
Telerik team
answered on 22 Dec 2011, 01:02 PM
Hello, Dan,

By default we haven't released this feature yet. It is scheduled for release in some of our future major releases. 
However for the time being, you can see how you can implement such behavior here. It can be implemented by using RadDragAndDropManager in Legacy mode.

Currently we are introducing an alternative DragAndDrop mechanism. The DragDropManager is available since our Q2 release this year and it provides much more intuitive API, that predisposes developers to implement more complex DragAndDrop scenarios. You can read more about it here.

Hope this helps!

Regards,
Nik
the Telerik team

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

0
Dan
Top achievements
Rank 1
answered on 22 Dec 2011, 07:47 PM
Thanks for response, Nik.

I ran your sample project for TreeView and it worked fine.  However, it does not work for GridView.  See below I made changes.
It compiled and ran OK but when I did drag over the GridView, it would not scroll vertical bar.

public class AutoScrollBehavior : Behavior<RadGridView>

<telerik:RadGridView ................>
    <i:Interaction.Behaviors>
        <local:AutoScrollBehavior />
    </i:Interaction.Behaviors>
</telerik:RadTreeView>








0
Nick
Telerik team
answered on 23 Dec 2011, 10:21 AM
Hello,

You have to modify the behavior a little bit to work with the GridView. It should use GridViewScrollViewer instead of ScrollViewer, since the GridView doesn't use ScrollViewer. 

Here is how it looks like:

public class AutoScrollBehavior : Behavior<RadGridView>
    {
        protected override void OnAttached()
        {
            base.OnAttached();
 
            EventManager.RegisterClassHandler(typeof(GridViewScrollViewer), RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnTreeViewScrollViewerDropQuery), true);
        }
 
        private static void OnTreeViewScrollViewerDropQuery(object sender, DragDropQueryEventArgs e)
        {
            var scrollViewer = sender as GridViewScrollViewer;
 
            if (scrollViewer != null)
            {
 
                var currentDragPoint = e.Options.CurrentDragPoint;
#if SILVERLIGHT
                var generalTransform = scrollViewer.TransformToVisual(Application.Current.RootVisual);
#else
                var generalTransform = scrollViewer.TransformToVisual(Window.GetWindow(scrollViewer));
#endif
                var topLeft = generalTransform.Transform(new Point(0, 0));
                var relative = new Point(currentDragPoint.X - topLeft.X, currentDragPoint.Y - topLeft.Y);
 
                if (relative.Y > 0 && relative.Y < 40)
                {
                    scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - (20 * ((40 - relative.Y) / 40)));
                }
 
                if (relative.Y > scrollViewer.ActualHeight - 40 && relative.Y < scrollViewer.ActualHeight)
                {
                    scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + (20 * ((40 - (scrollViewer.ActualHeight - relative.Y)) / 40)));
                }
 
                if (relative.X > 0 && relative.X < 40)
                {
                    scrollViewer.ScrollToHorizontalOffset(scrollViewer.HorizontalOffset - (20 * ((40 - relative.X) / 40)));
                }
 
                if (relative.X > scrollViewer.ActualWidth - 40 && relative.X < scrollViewer.ActualWidth)
                {
                    scrollViewer.ScrollToHorizontalOffset(scrollViewer.HorizontalOffset + (20 * ((40 - (scrollViewer.ActualWidth - relative.X)) / 40)));
                }
            }
        }
    }

Hope this helps!Regards,
Nik
the Telerik team

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

0
Dan
Top achievements
Rank 1
answered on 23 Dec 2011, 04:11 PM
That works cool to me.

Thanks very much, Nik.
0
Andrew
Top achievements
Rank 1
answered on 03 Aug 2012, 05:44 PM
I had a problem with this, and it turned out to be caused by row virtualization. The scrolling worked fine, but if I dragged something down and got it to scroll and then tried to drop somewhere, e.Options.Status was continually in the DropImpossible state, so I couldn't drop anywhere. Setting EnableRowVirtualization="False" fixed it though.
0
t
Top achievements
Rank 1
answered on 29 May 2017, 04:25 AM

<telerik:RadGridView
                    x:Name="timetableGrid"
                    controls:ContentHyperlink.Navigate="mainGrid_Navigate"
                    CanUserDeleteRows="False"
                    CanUserInsertRows="False"
                    RowIndicatorVisibility="Collapsed"
                    SelectionUnit="Cell"
                    CanUserSelect="False"
                    CanUserFreezeColumns="False"
                    AutoGenerateColumns="False"
                    CanUserReorderColumns="False"
                    CanUserSortColumns="False"
                    AllowDrop="True"
                    EnableColumnVirtualization="False"
                    EnableRowVirtualization="False"
                    ShowGroupPanel="False"
                    IsFilteringAllowed="False"
                    CanUserResizeRows="True"
                    VerticalGridLinesBrush="{x:Null}"
                    HorizontalGridLinesBrush="{x:Null}"
                    SelectionMode="Extended">
                    <i:Interaction.Behaviors>
                        <autoscroll:WPFAutoScrollBehavior />
                    </i:Interaction.Behaviors>
                    <telerik:RadGridView.LayoutTransform>
                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                    </telerik:RadGridView.LayoutTransform>
                </telerik:RadGridView>

public class WPFAutoScrollBehavior : Behavior<RadGridView>
    {
        protected override void OnAttached()
        {


            EventManager.RegisterClassHandler(typeof(GridViewScrollViewer), RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnTreeViewScrollViewerDropQuery), true);
        }

        private static void OnTreeViewScrollViewerDropQuery(object sender, DragDropQueryEventArgs e)
        {....}

I used the code above (like the example) and modified it as is for RadGridview but is not working at all. no scrollbar is NOT moving when I try to drag. The radtreeview - I was able to make it work but not when I change it to radgridview. Does it affect it that I have dragover events, drageneter etc?  I also added the EnableRowVirtualization="False" but not working. I am pulling my hair on this. what are other ways to implement this? 

0
t
Top achievements
Rank 1
answered on 29 May 2017, 04:30 AM
<telerik:RadGridView
                    x:Name="timetableGrid"
                    controls:ContentHyperlink.Navigate="mainGrid_Navigate"
                    CanUserDeleteRows="False"
                    CanUserInsertRows="False"
                    RowIndicatorVisibility="Collapsed"
                    SelectionUnit="Cell"
                    CanUserSelect="False"
                    CanUserFreezeColumns="False"
                    AutoGenerateColumns="False"
                    CanUserReorderColumns="False"
                    CanUserSortColumns="False"
                    AllowDrop="True"
                    EnableColumnVirtualization="False"
                    EnableRowVirtualization="False"
                    ShowGroupPanel="False"
                    IsFilteringAllowed="False"
                    CanUserResizeRows="True"
                    VerticalGridLinesBrush="{x:Null}"
                    HorizontalGridLinesBrush="{x:Null}"
                    SelectionMode="Extended">
                    <i:Interaction.Behaviors>
                        <autoscroll:WPFAutoScrollBehavior />
                    </i:Interaction.Behaviors>
                    <telerik:RadGridView.LayoutTransform>
                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                    </telerik:RadGridView.LayoutTransform>
                </telerik:RadGridView>

public class WPFAutoScrollBehavior : Behavior<RadGridView>
    {
        protected override void OnAttached()
        {


            EventManager.RegisterClassHandler(typeof(GridViewScrollViewer), RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnTreeViewScrollViewerDropQuery), true);
        }

        private static void OnTreeViewScrollViewerDropQuery(object sender, DragDropQueryEventArgs e)
        {....}

I used the code above (like the example) and modified it as is for RadGridview but is not working at all. Scrollbar is NOT moving when I try to drag. The radtreeview - I was able to make it work but not when I change it to radgridview. Does it affect it that I have dragover events, drageneter etc?  I also added the EnableRowVirtualization="False" but still not working. I am pulling my hair on this. what are other ways to implement this? Also, I found out that the OnTreeViewScrollViewerDropQuery() is not being hit, so it means the event is not registered (I used using Telerik.Windows.Controls.GridView; for the namespace of the scrollviwe). How can I make this work? thanks
0
t
Top achievements
Rank 1
answered on 29 May 2017, 04:31 AM
<telerik:RadGridView
                    x:Name="timetableGrid"
                    controls:ContentHyperlink.Navigate="mainGrid_Navigate"
                    CanUserDeleteRows="False"
                    CanUserInsertRows="False"
                    RowIndicatorVisibility="Collapsed"
                    SelectionUnit="Cell"
                    CanUserSelect="False"
                    CanUserFreezeColumns="False"
                    AutoGenerateColumns="False"
                    CanUserReorderColumns="False"
                    CanUserSortColumns="False"
                    AllowDrop="True"
                    EnableColumnVirtualization="False"
                    EnableRowVirtualization="False"
                    ShowGroupPanel="False"
                    IsFilteringAllowed="False"
                    CanUserResizeRows="True"
                    VerticalGridLinesBrush="{x:Null}"
                    HorizontalGridLinesBrush="{x:Null}"
                    SelectionMode="Extended">
                    <i:Interaction.Behaviors>
                        <autoscroll:WPFAutoScrollBehavior />
                    </i:Interaction.Behaviors>
                    <telerik:RadGridView.LayoutTransform>
                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                    </telerik:RadGridView.LayoutTransform>
                </telerik:RadGridView>

public class WPFAutoScrollBehavior : Behavior<RadGridView>
    {
        protected override void OnAttached()
        {


            EventManager.RegisterClassHandler(typeof(GridViewScrollViewer), RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnTreeViewScrollViewerDropQuery), true);
        }

        private static void OnTreeViewScrollViewerDropQuery(object sender, DragDropQueryEventArgs e)
        {....}

I used the code above (like the example) and modified it as is for RadGridview but is not working at all. Scrollbar is NOT moving when I try to drag. The radtreeview - I was able to make it work but not when I change it to radgridview. Does it affect it that I have dragover events, drageneter etc?  I also added the EnableRowVirtualization="False" but not working. I am pulling my hair on this. what are other ways to implement this? ALso, I foudn out that the OnTreeViewScrollViewerDropQuery() is not being hit, so it means the event is not registered (I used using Telerik.Windows.Controls.GridView; for the namespace of the scrollviwer). How can I make this work?
0
t
Top achievements
Rank 1
answered on 29 May 2017, 04:32 AM
<telerik:RadGridView
                    x:Name="timetableGrid"
                    controls:ContentHyperlink.Navigate="mainGrid_Navigate"
                    CanUserDeleteRows="False"
                    CanUserInsertRows="False"
                    RowIndicatorVisibility="Collapsed"
                    SelectionUnit="Cell"
                    CanUserSelect="False"
                    CanUserFreezeColumns="False"
                    AutoGenerateColumns="False"
                    CanUserReorderColumns="False"
                    CanUserSortColumns="False"
                    AllowDrop="True"
                    EnableColumnVirtualization="False"
                    EnableRowVirtualization="False"
                    ShowGroupPanel="False"
                    IsFilteringAllowed="False"
                    CanUserResizeRows="True"
                    VerticalGridLinesBrush="{x:Null}"
                    HorizontalGridLinesBrush="{x:Null}"
                    SelectionMode="Extended">
                    <i:Interaction.Behaviors>
                        <autoscroll:WPFAutoScrollBehavior />
                    </i:Interaction.Behaviors>
                    <telerik:RadGridView.LayoutTransform>
                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                    </telerik:RadGridView.LayoutTransform>
                </telerik:RadGridView>

public class WPFAutoScrollBehavior : Behavior<RadGridView>
    {
        protected override void OnAttached()
        {


            EventManager.RegisterClassHandler(typeof(GridViewScrollViewer), RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnTreeViewScrollViewerDropQuery), true);
        }

        private static void OnTreeViewScrollViewerDropQuery(object sender, DragDropQueryEventArgs e)
        {....}

I used the code above (like the example) and modified it as is for RadGridview but is not working at all. Scrollbar is NOT moving when I try to drag. The radtreeview - I was able to make it work but not when I change it to radgridview. Does it affect it that I have dragover events, drageneter etc?  I also added the EnableRowVirtualization="False" but not working. I am pulling my hair on this. what are other ways to implement this? ALso, I foudn out that the OnTreeViewScrollViewerDropQuery() is not being hit, so it means the event is not registered (I used using Telerik.Windows.Controls.GridView; for the namespace of the scrollviewer). How can I make this work?
0
Yoan
Telerik team
answered on 31 May 2017, 02:31 PM
Hi,

Actually, this is supported out-of-the-box in the current version of our controls. You need to use our ScrollingSettingsBehavior as demonstrated in this online demo.

Regards,
Yoan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Voss Grose
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Karan
Top achievements
Rank 1
Madhu
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Nick
Telerik team
Andrew
Top achievements
Rank 1
t
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or