C Sharp Scroll Bar: Difference between revisions

From Leo's Notes
This page was last edited on 24 February 2017, at 19:12.
Created page with "The scroll bar in WPF has a property named <code>ViewportSize</code> which controls the size of the thumb. The <code>ViewportSize</code> is calculated using the formula below:..."
 
m Text replacement - "<code>" to "{{code|"
Line 1: Line 1:
The scroll bar in WPF has a property named <code>ViewportSize</code> which controls the size of the thumb. The <code>ViewportSize</code> is calculated using the formula below:
The scroll bar in WPF has a property named {{code|ViewportSize</code> which controls the size of the thumb. The {{code|ViewportSize</code> is calculated using the formula below:


  ViewportSize = range * percent / (1 - percent)
  ViewportSize = range * percent / (1 - percent)


where
where
  * <code>range</code> is the range of the scroll bar.
  * {{code|range</code> is the range of the scroll bar.
  * <code>percent</code> is the percentage of content covered by the scroll bar between 0.0 and 0.99
  * {{code|percent</code> 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).
You will need to ensure that the view port size is not infinity (from a division by zero).

Revision as of 19:12, 24 February 2017

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).