views:

751

answers:

1

I am wokring on a touch screen on a small device and the custom width of the scroll-bar is no good as one of my requirements is that everything needs to be doable by finger gestures.

How can I set the width of the WPF ScrollViewer scrollbar?

Note that I don't wanna change the width of all the scrollbars on the device (doable through windows settings) - only the ones in my app.

Any help appreciated!

+5  A: 

The ScrollBar template reaches out for system parameters to determine its width/height (depending on orientation). Therefore, you can override those parameters:

<ScrollViewer>
    <ScrollViewer.Resources>
        <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">100</sys:Double>
    </ScrollViewer.Resources>
</ScrollViewer>

HTH, Kent

Kent Boogaart
thanks - it looks like what I need! I have the scrollviewer in a page - when I try to apply your suggestion I get sys:Double was not found --> any clue why? not really familiar with WPF
JohnIdol
You need to map the sys namespace to System in mscorlib like this: xmlns:sys="clr-namespace:System;assembly=mscorlib"
Kent Boogaart
thanks! perfect now
JohnIdol