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
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.
Is this feature available in Q3_2101 for WPF Gridviews ? ...
Regards,
Madhu
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
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!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
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>
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 >>
Thanks very much, Nik.
<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?
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
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?
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?
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