C Sharp Scroll Bar

From Leo's Notes
Last edited on 24 February 2017, at 19:14.

The scroll bar in WPF has a property named ViewportSize which controls the size of the thumb. The ViewportSize is calculated using the formula below:

ViewportSize = range * percent / (1 - percent)

where

* range is the range of the scroll bar.
* percent is the percentage of content covered by the scroll bar between 0.0 and 0.99

You will need to ensure that the view port size is not infinity (from a division by zero).