using System; using System.Collections.Generic; using System.Text; using System.Windows; using HandyControl.Controls; namespace WolfOfWallStreet.Helper { public static class ScrollHelper { public static bool GetAutoScroll(DependencyObject obj) { return (bool)obj.GetValue(AutoScrollProperty); } public static void SetAutoScroll(DependencyObject obj, bool value) { obj.SetValue(AutoScrollProperty, value); } public static readonly DependencyProperty AutoScrollProperty = DependencyProperty.RegisterAttached("AutoScroll", typeof(bool), typeof(ScrollHelper), new PropertyMetadata(false, AutoScrollPropertyChanged)); private static void AutoScrollPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var scrollViewer = d as ScrollViewer; if (scrollViewer != null && (bool)e.NewValue) { scrollViewer.ScrollToBottom(); } } } }