WPF RadGridView ScrollIntoView - row partially visible

0 Answers 49 Views
GridView
corner4
Top achievements
Rank 1
corner4 asked on 21 Dec 2021, 09:17 PM

We are updating to Telerik.Windows.Controls.GridView 2021.2.615.45.

The methods "ScrollIntoViewAsync" and "ScrollIndexIntoViewAsync" are not working as expected, in the case that a row would be partially visible:

 

As you see in the above screenshot - we insert a new row with "BeginInsert" and set the new row visible. Even if we call "ScrollIntoView" the row is not fully visible as expected.

The bug is located in FlatLayoutStrategy.IsRowInViewPort:

As you can see in the screen above, the logic only checks if the beginning of the row is visible - but not the full row.

Comparing it to Telerik.Windows.Controls.GridView 2014.1.331.45 - the logic worked as expected - see here:

With this old logic, the row is fully scrolled into viewport.

Can you fix this logic or give me a workaround?

 

 

Martin Ivanov
Telerik team
commented on 23 Dec 2021, 10:55 AM

Can you show me how exactly the whole procedure is executed - insert + scroll? A sample project showing this will be very useful. I also attached a small example that you can use as a base for a reproducible sample.

Additionally, you can test the latest release and see if the issue still occurs.

corner4
Top achievements
Rank 1
commented on 10 Jan 2022, 08:08 AM | edited

Hello Martin,

thank you for your quick response with your sample project.

Sure it can be reproduced - i have build it with your sample project - see attached file. I only changed your source here:

  • Window.Height="425"
  • RadGridView.RowHeight="50"
  • Item Seed Count = 6

If you click "Insert" the new item is only partially visible:

Can you reproduce it now?


Thanks

Martin Ivanov
Telerik team
commented on 10 Jan 2022, 12:33 PM

Hey Jürgen. Thank you for the project. I've reproduced this and I can confirm that it is an issue in the control. You can find it logged in the Telerik's feedback portal where you can track its status. You can also find your Telerik points updated. 

To work this around, you can manually scroll the vertical scrollviewer after the item is inserted.

private void BeginInsertRow()
{
	var scrollViewer = this.gridView.FindChildByType<GridViewScrollViewer>();
	bool requestScrollToBottom = false;
	if (scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Collapsed)
	{
		var panel = this.gridView.FindChildByType<GridViewVirtualizingPanel>();
		var sumHeight = (source.Count + 1) * this.gridView.RowHeight;                
		requestScrollToBottom = sumHeight > panel.ActualHeight;                
	}
	this.gridView.BeginInsert();

	if (requestScrollToBottom)
	{
		scrollViewer.ScrollToBottom();
	}            
}

No answers yet. Maybe you can help?

Tags
GridView
Asked by
corner4
Top achievements
Rank 1
Share this question
or