maui icon indicating copy to clipboard operation
maui copied to clipboard

[Windows] Scrollbars Visibility property "Always" is not working consistently in the ScrollView control

Open Deepak1799 opened this issue 3 years ago • 10 comments
trafficstars

Description

I am using MaUI scrollView control and I want to show the scrollbars "always" in the windows platform if the content size is more. So I am using the scrollview properties "HorizontalScrollBarVisibility" and "VerticalScrollBarVisibility" as "Always". However the scrollbar fades away after sometimes. This issue occurs consistently when changing the scrollbar visibility at the runtime, and happens sometime when setting the scrollbar visibility at the compile time.

Steps to Reproduce

  1. Create a MaUI App.
  2. Add a scroll View control, keep a large size content inside the scroll viewer.
        <ScrollView 
        HeightRequest="200" WidthRequest="200" x:Name="MyScrollView" HorizontalScrollBarVisibility="Never" VerticalScrollBarVisibility="Never">
            <Grid BackgroundColor="Red" x:Name="grid" HeightRequest="400" WidthRequest="400">
            </Grid>
        </ScrollView>
  1. Run the app.
  2. In a button click, set the scrollbar visibility (horizontal and vertical) to always. It will not show the scrollbar always, and the scrollbars will fade away after few seconds.
    private void Button_Clicked(object sender, EventArgs e)
    {
		MyScrollView.HorizontalScrollBarVisibility = ScrollBarVisibility.Always;
		MyScrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Always;
    }

Repro sample is attached here: MauiApp1.zip

If you are using the sample, Run the sample --> Click the button "Show Scrollbar always". Then test the mentioned scrollbar visibility behavior.

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows, macOS

Affected platform versions

Windows SDK 10.0.19041

Did you find any workaround?

No

Relevant log output

NA

Deepak1799 avatar Jun 05 '22 08:06 Deepak1799

verified repro on windows with above repro project. 17.3.0 Preview 3.0 [32605.41.main].

kristinx0211 avatar Jun 06 '22 06:06 kristinx0211

Is because the default Scroll Orientation is Vertical. Set the Orientation property to Both value and should works as expected.

jsuarezruiz avatar Jun 07 '22 11:06 jsuarezruiz

Hi @Deepak1799. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Jun 07 '22 11:06 ghost

Hi @jsuarezruiz ,

Thank you for the reply. If the orientation is the problem, the vertical scrollbar should not have this issue with the default orientation of "vertical". However the issue occurs in vertical scrollbar also.

Note: I have tried setting the orientation to "Both" and I am still facing the same issue. I have attached the modified sample here MauiApp1.zip

I guess there might be a miscommunication. The issue is not about scrollbar is not shown, but it gets automatically hides after a short duration. If the property is "Always", the scrollbar should not auto hide at any moment.

Could you please check and provide your suggestion on this?

Deepak1799 avatar Jun 10 '22 05:06 Deepak1799

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Aug 30 '22 14:08 ghost

[Android] Scrollbars Visibility property "Always" is not working consistently in the ScrollView control

I am using MaUI scrollView control and I want to show the scrollbars "always" in the android platform if the content size is more. So I am using the scrollview properties "HorizontalScrollBarVisibility" and "VerticalScrollBarVisibility" as "Always". However the scrollbar fades away after sometimes. scrollbar is not always visible <ScrollView VerticalScrollBarVisibility="Always" HorizontalScrollBarVisibility="Always">

SuthiYuvaraj avatar Oct 19 '22 14:10 SuthiYuvaraj

I'm facing the same issue, but I don't think it is an issue, more it is like this "should be". If you'll set the visibility to Always the scrollbar will be visible only when mouse is over it. So for Windows, the meaning for Always is not full-filled IMO. Yes, is there, but not visible. So, this is a OS related issue?

valimaties avatar Oct 30 '22 09:10 valimaties

Verified this on Visual Studio Enterprise 17.6.0 Preview 7.0. Repro on Windows 11 with below Project: 7766.zip

  1. Run the project
  2. Click Show Scrollbar always
  3. Mouse hover over the red grid
  4. The scrollbar displayed for about 5 seconds and then it is not visible. ScrollBar

XamlTest avatar May 15 '23 08:05 XamlTest

@valimaties @Deepak1799 A similar issue was raised on the underlying WinUI3 repo: https://github.com/microsoft/microsoft-ui-xaml/issues/6703

And you can see it happening in the WinUI 3 Gallery app. The settting to make them always visible appears to be an OS setting as far as Windows is concerned: Settings -> Accessibility -> Visual effects -> Always show scrollbars

jeremy-visionaid avatar Dec 20 '23 02:12 jeremy-visionaid

I Solved this problem as below: Add code in MainPage()

          Microsoft.Maui.Handlers.ScrollViewHandler.Mapper.AppendToMapping("ObviousScrollViewCustomization",
               (handler, view) => {
                   handler.PlatformView.ScrollbarFadingEnabled = false;
                   handler.PlatformView.ScrollBarFadeDuration = 0;
                   handler.PlatformView.ScrollBarStyle = Android.Views.ScrollbarStyles.InsideOverlay;
               });

franklintw1122 avatar May 24 '24 09:05 franklintw1122

@valimaties @Deepak1799 A similar issue was raised on the underlying WinUI3 repo: microsoft/microsoft-ui-xaml#6703

And you can see it happening in the WinUI 3 Gallery app. The settting to make them always visible appears to be an OS setting as far as Windows is concerned: Settings -> Accessibility -> Visual effects -> Always show scrollbars

Omg !!! Thanks you @jeremy-visionaid I was like orthers and think it was a bug with the OS but no, you are right, on Windows, there's a settings to auto-hide ALL Windows scrollbar that build ontop of WinUI after couple seconds. Well, nothing on MAUI (WinUI) that can override the system settings ? The only way I could style that scrollbar is to add the original style/template in App.xaml in platforms/windows and custom it : https://github.com/microsoft/microsoft-ui-xaml/blob/winui3/release/1.4-stable/controls/dev/CommonStyles/ScrollBar_themeresources.xaml

BlinkSun avatar Aug 21 '24 20:08 BlinkSun