How to change a ListBox's Vertical Scrollbar&#

2019-07-29 09:00发布

问题:

I have a ListBox control with a vertical scrollbar. I would like to increase the Repeat Buttons' Height to something bigger because our UI is touch-compatible.

Is there a simple way to do it ?

Thank you and best regards,

Romanin

回答1:

Easiest is to modify the ControlTemplate for a vertical scrollbar and change it to what you want: ScrollBar ControlTemplate Example



回答2:

It's not so easy to just change the button sizes, because they are hardcoded in the default template. But you can scale the whole ScrollBar control by a factor. Just put this Style to your Window or Control resources.

<Window.Resources>
   <Style TargetType="ScrollBar">
      <Setter Property="LayoutTransform">
           <Setter.Value>
               <ScaleTransform CenterX="0" CenterY="0"
                               ScaleX="2" ScaleY="2" />
           </Setter.Value>
        </Setter>
   </Style>
</Window.Resources>