using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Tango.StubsUtils.Service.UI.Controls { public class ScrollableFlowDocumentScrollViewer : FlowDocumentScrollViewer { /// /// Backing store for the property. /// private ScrollViewer scrollViewer; /// /// Gets the scroll viewer contained within the FlowDocumentScrollViewer control /// public ScrollViewer ScrollViewer { get { if (this.scrollViewer == null) { DependencyObject obj = this; do { if (VisualTreeHelper.GetChildrenCount(obj) > 0) obj = VisualTreeHelper.GetChild(obj as Visual, 0); else return null; } while (!(obj is ScrollViewer)); this.scrollViewer = obj as ScrollViewer; } return this.scrollViewer; } } } }