How to change a ListBox's Vertical Scrollbar's Repeat Button Size in WPF

僤鯓⒐⒋嵵緔 提交于 2019-12-24 10:56:52

问题


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>


来源:https://stackoverflow.com/questions/3832148/how-to-change-a-listboxs-vertical-scrollbars-repeat-button-size-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!