'How to Create a Custom Scrollbar in UWP?

I need to create a custom Scrollbar in UWP ? But I can't find any clear logic to calculate Scrollbar thumb width and Position. What I have tried ?

ThumbWidth=(VisibleLength/TotalLength)*ScrollRegionWidth;
ThumbPosition=(ScrollLeft/TotalLength)*ScrollRegionWidth;

where,

VisibleLength -> viewable area width  
TotalLength -> Total Content width  
ScrollRegionWidth -> Scrollbar width - (2 x ArrowWidth)  (or) Thumb Track width
ScrollLeft -> how much content scrolled !! 

Is it correct ? I tried like this . But the scrollbar thumb won't goes to end of thumb track while my whole content is scrolled to end !

I need to create a custom Scrollbar and how to do it ? I need complete logic for thumb width and position .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source