Change default time of auto-hide timer of ScrollViewer scrollbars

拥有回忆 提交于 2019-12-01 05:32:36

问题


When a ScrollViewer has scrollbars showing, and the cursor is not moved for around 3 seconds, the scrollbars auto hide.

Is there a way to set that time to more or less than the default time?

EDIT

Reproduce so:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <ScrollViewer Height="500" Width="500">
        <Grid Background="Blue" Height="1000" Width="1000">                
        </Grid>            
    </ScrollViewer>
</Grid>

Move the cursor over the ScrollViewer to show the scrollbar. Leave the cursor motionless for 3 seconds to see the scrollbar disappear. I want to change those 3 seconds to 1.

EDIT 2

Follow-up question - Why does this ScrollViewer's ScrollBars appear twice? .


回答1:


I suppose I need to start breaking the habit of doing quickie answers in comments anyway so;

Carrying from the original comments above. The control style templates for Scrollbar have embedded ThemeAnimation's for FadeIn/FadeOut nested in various states in the VisualStateManager portion.

Being that they're animations inheriting in order of;

Object -> DependencyObject -> Timeline

...they do support Dependency Properties such as BeginTime and Duration that allows us to alter the default behavior of their action. So to remedy your scenario you have the options of either removing them entirely from their respective states within the VisualStateManager or you can alter the properties to better suit your needs of your own timeline requirements.

Doing this is just a matter of extracting the control template using either VS or Blend and either applying changes explicitly to a copy of the template or overriding the default globally.

Glad you found your remedy. :)



来源:https://stackoverflow.com/questions/37389446/change-default-time-of-auto-hide-timer-of-scrollviewer-scrollbars

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