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

Automatic Scrolling to SelectedItem

2 Answers 204 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GlenC
Top achievements
Rank 2
GlenC asked on 19 Jun 2009, 10:33 AM
I have two controls, a RadGridView and RadCoverflow bound to the same ObservableCollection, the former to display the data, the latter to display associated Thumbnail.  When I select the Thumbnail image on the coverflow the appropriate item is also selected on the GridView, however if there is a lot of data and the vertical scrollbars are showing on the GridView, the correct row is selected but I would like the Grid to automatically scroll to that item - is it possible or any sufggestions as to how to implement this?

Cheers

Glen

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 19 Jun 2009, 12:21 PM
Hello GlenC,

RadGridView cannot automatically scroll to the selected item but you can easily implement such functionality. Just subscribe to the SelectionChanged event and in the event handler use the BrindDataItemIntoView method to scroll to the selected record/item.

Here is a sample snippet:

public Page()  
{  
    InitializeComponent();  
 
    this.data = GetMessages();  
    this.RadGridView1.ItemsSource = this.data;  
    this.RadGridView1.SelectionChanged += new EventHandler<SelectionChangeEventArgs>(RadGridView1_SelectionChanged);  
}  
 
void RadGridView1_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)  
{  
    this.RadGridView1.ItemsControl.BringDataItemIntoView(this.RadGridView1.SelectedItem);  


Kind regards,
Milan
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.
0
GlenC
Top achievements
Rank 2
answered on 19 Jun 2009, 12:57 PM
Thanks Milan,

very quick reply and it works for me

CHeers

Glen
Tags
GridView
Asked by
GlenC
Top achievements
Rank 2
Answers by
Milan
Telerik team
GlenC
Top achievements
Rank 2
Share this question
or