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

BringIndexIntoView with Collapsed Group

2 Answers 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
BobK
Top achievements
Rank 1
BobK asked on 20 Feb 2015, 02:38 AM
Using RadGridView, I'm attempting to programmatically select a row and bring it into view.  Code works, unless the row is within a collapsed group.  If the row is within a collapsed group, I get an Out Of Range Exception.

How can I identify and expand the containing groups or otherwise work around this problem?

Thank you!
Bob

Code follows:

foreach (DataRowView rowView in vm.ResultSet.DefaultView)
{
     if (rowView["UWI"].ToString().Trim() == uwi)
         {
             vm.SelectedRowView = rowView;
             WellsGridView.BringIndexIntoView(WellsGridView.Items.IndexOf(WellsGridView.SelectedItem));
             break;
         }
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Vera
Telerik team
answered on 20 Feb 2015, 03:40 PM
Hi BobK,

I would suggest you to use RadGridView.ScrollIntoView or RadGridView.ScrollIndexIntoView method instead as BringIndexIntoView will not work before the item containers have been generated. Those methods will also expand the group containing the item.

Regards,
Vera
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
BobK
Top achievements
Rank 1
answered on 20 Feb 2015, 11:00 PM
Hello, Vera,

Perfect!  Switching to ScrollIndexIntoView solved the problem nicely.

Regards,
Bob
Tags
GridView
Asked by
BobK
Top achievements
Rank 1
Answers by
Vera
Telerik team
BobK
Top achievements
Rank 1
Share this question
or