I need to set programmatically the scroll of a GridView by code.
I can set the value of the scrollbars of my GridView by code. Unfortunatly the content of the grid doesn't scroll automatically if I change the value of the scrollbar.
Here the code to obtain and set the value of the scrollbars of your GridView:
GridViewItemsControl gridViewItemsControl = (GridViewItemsControl)RadGridView1.Template.FindName("PART_RootItemsControl", RadGridView1);
GridViewScrollViewer scrollviewer = (GridViewScrollViewer)gridViewItemsControl.Template.FindName("PART_ItemsScrollViewer", gridViewItemsControl);
ScrollBar verticalscrollbar = (ScrollBar)scrollviewer.Template.FindName("PART_VerticalScrollBar", scrollviewer);
ScrollBar horizontalscrollbar = (ScrollBar)scrollviewer.Template.FindName("PART_HorizontalScrollBar", scrollviewer);
horizontalscrollbar.Value = horizontalscrollbar.Maximum;
verticalscrollbar.Value = verticalscrollbar.Maximum;
Now how can I set the vertical/horizontal offset of the GridView 's content ?
Thanks,
Davide