I see there's an API to scroll a record into view:
RadGridView.ItemsControl.BringRecordIntoView
But I also need the ability to insure that a specific cell is also in view (if the grid has horizontal scroll bars), but I see no public API to do this.
3 Answers, 1 is accepted
0
Hello Gary,
You can use this method to bring a random cell into view:
Hope this helps.
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.
You can use this method to bring a random cell into view:
private void BringIntoView(int rowIndex, int cellIndex) |
{ |
var record = this.RadGridView1.Records[rowIndex]; |
this.RadGridView1.ItemsControl.BringRecordIntoView(record); |
this.Dispatcher.BeginInvoke( |
(Action) delegate |
{ |
var row = this.RadGridView1.ItemsControl.ItemsGenerator.ContainerFromItem(record) as GridViewRow; |
((GridViewCell)row.Cells[cellIndex]).IsCurrent = true; |
}); |
} |
Hope this helps.
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
Gary
Top achievements
Rank 1
answered on 15 Jun 2009, 05:09 PM
This code only works for records that are currently visible in the grid. If I try to focus on a cell that is in a row that is not visible then ContainerFromItem in the delegate you provided returns null. I'm guessing this is because the records are virtualized, and the row has not yet been rendered?
Is there a way to delay execution of the delagate until after the row the cell is located in has been brought into view?
0
Accepted
Hi Gary,
The method uses the Dispatcher to delay execution but it seems that it is not working correctly.
Could you try invoking the dispatcher with a lower priority:
Hope this works.
Best wishes,
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.
The method uses the Dispatcher to delay execution but it seems that it is not working correctly.
Could you try invoking the dispatcher with a lower priority:
this.Dispatcher.BeginInvoke |
((Action)delegate |
{ |
var row = this.RadGridView1.ItemsControl.ItemsGenerator.ContainerFromItem(record) as GridViewRow; |
((GridViewCell)row.Cells[cellIndex]).IsCurrent = true; |
}, System.Windows.Threading.DispatcherPriority.ApplicationIdle, null |
); |
Hope this works.
Best wishes,
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.