question

jtorjo avatar image
0 Votes"
jtorjo asked ·

force normal scroll bars

How do I force the scroll bars to be ALWAYS SHOWN?

That little small line shown where you need to actually go there, and then it's shown and then it gets hidden - I don't know who came up with it, but clearly did not ask us, the developers, if we want it. No one wants that - IT'S CONFUSING.

I want a normal scroll bar that is always shown. How do i do that?

windows-uwp
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

When you set the ScrollViewer.VerticalScrollBarVisibility as Visible, can the scroll bar display? In addition, do you mean you also want to get the size of the scroll bar?

0 Votes 0 ·
danielescipioni avatar image
0 Votes"
danielescipioni answered ·

I modified the default ScrollBar style starting from the one for version 10.0.17763.0, and created a resource dictionary attached here ScrollBarStyleDictionary.xaml.txt (rename in .xaml).

You can use it as Resource in the Control where you want classic ScrollBars or globally in your Application.Resources.

As example I added the XAML snippet below. In a 2x2 Grid the first row has 2 ScrollViewers and the second has 2 ListView. On both ScrollViewer and ListView in the first column I added the ScrollBarStyleDictionary.xaml and they always show the ScrollBars.

<Grid ColumnSpacing="8" RowSpacing="8">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <ScrollViewer Grid.Row="0" Grid.Column="0" HorizontalScrollBarVisibility="Visible">
        <ScrollViewer.Resources>
            <ResourceDictionary Source="ScrollBarStyleDictionary.xaml"/>
        </ScrollViewer.Resources>
        <Rectangle Width="1000" Height="1000">
            <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="Aqua" Offset="0"/>
                    <GradientStop Color="GreenYellow" Offset="0.5"/>
                    <GradientStop Color="Red" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
    </ScrollViewer>
    <ScrollViewer Grid.Row="0" Grid.Column="1" HorizontalScrollBarVisibility="Auto">
        <Rectangle Width="1000" Height="1000">
            <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="Aqua" Offset="0"/>
                    <GradientStop Color="GreenYellow" Offset="0.5"/>
                    <GradientStop Color="Red" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
    </ScrollViewer>
    <ListView Grid.Row="1" Grid.Column="0" ItemsSource="{x:Bind _items}">
        <ListView.Resources>
            <ResourceDictionary Source="ScrollBarStyleDictionary.xaml"/>
        </ListView.Resources>
    </ListView>
    <ListView Grid.Row="1" Grid.Column="1" ItemsSource="{x:Bind _items}"/>
</Grid>


If you want to change the size of a ScrollBars add this "<x:Double x:Key="ScrollBarSize">16</x:Double>" to Application.Resources (global) or specific control Resources.

Let me know, happy to help.






· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This is perfect, thanks!

Please note that before, I got something from stackoverflow, which was also a huge pile of xaml, but that didn't work. This, so far, works 100% of the time. Thanks again!

0 Votes 0 ·
mrlacey avatar image
0 Votes"
mrlacey answered ·

Depending on the control that contains the scroll bars, you can set ScrollViewer.VerticalScrollBarVisibility="Visible" so that the scroll indicator is always shown.
If you want a traditional Win32/ComCtrl style wide scroll bar always visible, you may need to restyle the control and/or add a ScrollBar control where you want it shown.

The default visuals of the default controls are the standard for Windows10. If you want something beyond the default conventions for the platform you'll have to modify as per your requirements.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks. I am well aware of VerticalScrollBarVisibility - and the fact that those are "defaults" nobody wants is beyond sad.

There should be at least a way for me to tell the "size" of the bar (the height for a horizontal scrollbar and width for a vertical scrollbar)

0 Votes 0 ·
danielescipioni avatar image
0 Votes"
danielescipioni answered ·

If you go to Settings > Ease of Access > Display > Automatically hide scroll bars in Windows and set the switch to Off the scroll bars will be visible as the classic one. Can this per user configuration answer to your request?

· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for this!

I wasn't aware of it, and I'm pretty sure 99% of the users aren't. Having said that, I would love to have any of the following:

  • a way to turn this setting on/off for my app programatically

  • a way to do this programmatically, for a specific scroll bar

0 Votes 0 ·

Just I do not understand why you absolutely need your app have the classic scrollbar, isn't good that each user can choose the preferred scrollbar aspect behavior and that this is the same across all the apps? I like this modern app bars and I like that there is a setting that allow users to choose preferred behavior, just my opinion.

I think is not possible that an app programmatically changes setting "Settings > Ease of Access > Display > Automatically hide scroll bars in Windows", as it affect all the system.

About the last point, I made some experiment working on the ScrollBar style, but still nothing good to post here. I will if I find a working solution.

0 Votes 0 ·
jtorjo avatar image
0 Votes"
jtorjo answered ·

I like this modern app bars and I like that there is a setting that allow users to choose preferred behavior, just my opinion.

Yeah, I'm quite sure you are in the minority. People struggle with the "modern" scrollbars when they actually need to use them. This is just one more of those great "mobile first" things no one wants. But you guys don't seem to care about this and still consider them a good thing to have.

Please show me where in Davinci Resolve, Adobe products, etc. - any decent enterprise app do they use these "modern" scrollbars.

I think is not possible that an app programmatically changes setting "Settings > Ease of Access > Display > Automatically hide scroll bars in Windows", as it affect all the system.

I would be fine with that, if this was the default.

About the last point, I made some experiment working on the ScrollBar style, but still nothing good to post here. I will if I find a working solution.

Yes, please. Thanks!

EDIT: I tried to delete this when I realized I mistakenly posted at as an answer, but then I could not enter the same thing as a comment. This forum is just amazing.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.