I edited a ScrollViewer's template to wait only 0.5 seconds before hiding the scrollbars, and this succeeds in hiding them at that time, but they reappear for another 0.5 seconds. Why?
To reproduce, create a page resource for a ScrollViewer's Style with the default Template (find it here on MSDN) and change the 3 occurances of "3" to "0.5". Then use the following XAML:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ScrollViewer Height="500" Width="500" Style="{StaticResource ScrollViewerControlTemplate1}">
<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 0.5 seconds to see the scrollbar disappear. It then reappears for another 0.5 seconds. Why?
I have a feeling you're not going to make it work, but if you REALLY think it's worth your time - you could put the ScrollBars
in your own grids and run your own animations on the grids whenever you decide you want to do that.
来源:https://stackoverflow.com/questions/37467867/why-does-this-scrollviewers-scrollbars-appear-twice