Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollIntoView method for DataGrid throws ArgumentOutOfRangeException #6127

Closed
maxkatz6 opened this issue Jun 24, 2021 Discussed in #6099 · 0 comments · Fixed by #6146
Closed

ScrollIntoView method for DataGrid throws ArgumentOutOfRangeException #6127

maxkatz6 opened this issue Jun 24, 2021 Discussed in #6099 · 0 comments · Fixed by #6146

Comments

@maxkatz6
Copy link
Member

Discussed in #6099

Originally posted by ShrutiJaiswal1494 June 18, 2021
Hi,

I am trying to change the SelectedItem of a DataGrid from code behind but by default, the view doesn't scroll to the selected item. I see there is a ScrollIntoView method available to do that. Using the below code throws an exception
System.ArgumentOutOfRangeException: 'Specified argument was out of the range of valid values. (Parameter 'index')'

Is there any other way to achieve this?

Code:

dataGrid.ScrollIntoView(dataGrid.SelectedItem, null);
```</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant