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

Any way to use ScrollPositionIndicatorTemplate AND ScrollMode=RealTime?

1 Answer 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 29 Jan 2020, 10:22 PM

I would still like to be able to see what row the scroll is at even when the mode is RealTime. Like Word, Excel, etc. can do. Is there any way to make that happen?

 

Absent using the template, is there any place to hook in to show something myself?

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 03 Feb 2020, 11:34 AM

Hi Steve,

What you can try is to get the vertical ScrollBar and subscribe to its ValueChanged event. In the event handler, you can get all generated rows in the viewport by using the ChildrenOfType<T>() extension method and get the first one. Then you can consider showing some ToolTip or TextBlock.

private void GridView_Loaded(object sender, RoutedEventArgs e)
{
    var verticalScrollBar = this.gridView.ChildrenOfType<ScrollBar>().FirstOrDefault();
    if(verticalScrollBar != null)
    {
        verticalScrollBar.ValueChanged += VerticalScrollBar_ValueChanged;
    }
}

private void VerticalScrollBar_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
    var row = this.gridView.ChildrenOfType<GridViewRow>().FirstOrDefault();
    Debug.WriteLine((row.DataContext as MyGridItem).MyProperty);
}

As a side note, you can try using the built-in ScrollPositionIndicator functionality of the control. This feature works only when the ScrollMode property is set to Deferred. Still, you can consider using this functionality if it covers your requirements.

Regards,
Dinko
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Steve
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or