C Sharp Scroll Bar

From Leo's Notes
Revision as of 19:12, 24 February 2017 by Leo (talk | contribs) (Text replacement - "<code>" to "{{code|")
This page was last edited on 24 February 2017, at 19:12.

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

ViewportSize = range * percent / (1 - percent)

where

* {{code|range is the range of the scroll bar.
* {{code|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).