BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi Gary,
We have analysed your query, you can achieve your
requirements by getting the ScrollableContentViewer from VisualTreeHelper, and
then you can directly use the ScrollToHorizontalOffset method from ScrollableContentViewer object.
Please refer the following code snippet.
Code Snippet [C#]:
void MainPage_Loaded(object sender, RoutedEventArgs e) { scrollViewer = FindDescendant(datagrid, typeof(ScrollableContentViewer)) as ScrollableContentViewer; scrollViewer.ScrollToHorizontalOffset(offset); }
DependencyObject FindDescendant(DependencyObject startingFrom, Type typeDescendant) { DependencyObject visual = null; var iCount = VisualTreeHelper.GetChildrenCount(startingFrom); for (var i = 0; i < iCount; ++i) { var child = VisualTreeHelper.GetChild(startingFrom, i); if (typeDescendant == child.GetType()) { visual = child; break; } visual = FindDescendant(child, typeDescendant); if (visual != null) break; } return visual; }
|
Please let us know if you need further assistance
Regards,
Prakash S.
Hi Gary,
Thank you for your feedback, please let us know if you have any concerns.
Regards,
Prakash S.