maui
maui copied to clipboard
[Windows] Scrollbars Visibility property "Always" is not working consistently in the ScrollView control
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
- Create a MaUI App.
- 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>
- Run the app.
- 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
verified repro on windows with above repro project. 17.3.0 Preview 3.0 [32605.41.main].
Is because the default Scroll Orientation is Vertical. Set the Orientation property to Both value and should works as expected.
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.
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?
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.
[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">
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?
Verified this on Visual Studio Enterprise 17.6.0 Preview 7.0. Repro on Windows 11 with below Project: 7766.zip
- Run the project
- Click Show Scrollbar always
- Mouse hover over the red grid
- The scrollbar displayed for about 5 seconds and then it is not visible.
@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
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;
});
@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