Search code examples
c#uwpscrollbaruwp-xamlscrollviewer

How to get scrollbar height in scrollviewer in uwp?


how to get scollbar height in scrollviewer in uwp just like shown in this photo.

enter image description here


Solution

  • How to get scrollbar height in scrollviewer in uwp?

    Please check ScrollBar style(stored in the general.xaml file), the matched part like above screenshot is VerticalThumb, you could copy the following style in your page resource, and detect VerticalThumb load event, and get the ActualHeight property with following code.

    private void VerticalThumb_Loaded(object sender, RoutedEventArgs e)
    {
        var verticalThumb = sender as Thumb;
    
        var height = verticalThumb.ActualHeight;
    }