BringIntoView Method BringIntoView Method wpf wpf

BringIntoView Method


Try this one:

private void ScrollToGroupBox(GroupBox groupBox){  GeneralTransform groupBoxTransform = groupBox.TransformToAncestor(scrollViewer);  Rect rectangle = groupBoxTransform.TransformBounds(new Rect(new Point(0, 0), groupBox.RenderSize));  scrollViewer.ScrollToVerticalOffset(rectangle.Top + scrollViewer.VerticalOffset);}

The code gets the position of your GroupBox inside the Scrollviewer and scrolls to it.