/// <summary> /// Brings the into view. /// </summary> /// <param name="frameworkElement">The framework element.</param> /// <param name="animate">If set to <c>true</c> [animate].</param> public static void BringIntoView(this FrameworkElement frameworkElement, bool animate = false) { var parent = VisualTreeHelper.GetParent(frameworkElement); while (parent != null) { parent = VisualTreeHelper.GetParent(parent); var scrollViewer = parent as ScrollViewer; if (scrollViewer != null) { frameworkElement.BringIntoViewForScrollViewer(scrollViewer, animate); break; } } }