ScrollBar.SmallChange

Feb 3, 2011 at 12:21 PM
Edited Feb 3, 2011 at 12:23 PM

Hi

Our use case for HorizontalScrollBar is scrolling data of signal within a window by pressing MLB.
At present ScrollBar object is protected and is not accessible while HorizontalScrollBar class is sealed.
ScrollBar.SmallChange property default value 0.1 leeds to very slow scrolling and is not adaptive to data.

		protected override void UpdateScrollBar(Viewport2D viewport)
		{
			if (viewport != null && !viewport.Domain.IsEmpty)
			{
				var visibleRange = new Range(viewport.Visible.XMin, viewport.Visible.XMax);

				double size = visibleRange.Max - visibleRange.Min;
				ScrollBar.ViewportSize = size;

				var domainRange = new Range(viewport.Domain.XMin, viewport.Domain.XMax);
				ScrollBar.Minimum = domainRange.Min;
				ScrollBar.Maximum = domainRange.Max - size;

				ScrollBar.Value = visibleRange.Min;
				ScrollBar.SmallChange = size * 0.1d; <==

				ScrollBar.Visibility = Visibility.Visible; 
			}
			else
			{
				ScrollBar.Visibility = Visibility.Collapsed;
			}
		}

<== - shows changes for more appropriate scroll speed related to size, possibly make a property for tune;