Open riccardominato opened 1 year ago
This is not Android-specific. The same thing seems to occur on Windows with that code block if you use "Neither" or "Horizontal"
Verified this on Visual Studio Enterprise 17.8.0 Preview 5.0(8.0.0-rc.2.9373). Repro on Windows 11 with below Project: ScrollViewOrientationNeither.zip
temporary workaround for this: https://www.sharpnado.com/net-maui-disable-scrolling-on-android/
Yes, sharpnado's workaround mentioned above worked for me, except that I have modified it to map the IScrollView.Orientation property instead of the IScrollView.IsEnabled property. In MauiScrollViewEnable instead of UpdateIsEnabled(bool isEnabled) I now have:
public void UpdateOrientation(ScrollOrientation orientation)
{
_disableScrolling = orientation == ScrollOrientation.Neither;
}
The reason for this is that setting IsEnabled of my scroll view to false was also affecting the child elements in my scroll view which I didn't want.
temporary workaround for this: https://www.sharpnado.com/net-maui-disable-scrolling-on-android/
System.InvalidCastException: Specified cast is not valid. at ScrollViewEnableHandler.<>c.<.ctor>b__0_0(IScrollViewHandler handler, IScrollView view) in
Not sure why, but when I try Sharpnado's workaround, my app crashes when entering the page with the ScrollView
Description
Setting
ScrollView
Orientation option toNeither
seems not to have effect on Android.Steps to Reproduce
ContentPage
Expected result: I shouldn't be able to scroll and see the Hello World label. Actual result: I can scroll until I see the Hello World label.
Link to public reproduction project repository
https://github.com/Riccardo11/MauiIssues/tree/main/ScrollViewOrientationNeither
Version with bug
8.0.0-rc.2.9373
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 13. Didn't test other Android versions.
Did you find any workaround?
Setting
IsEnabled
attribute to false could be a workaround for someone to do something similar to the expected behavior. Unfortunately, that's not my case.Relevant log output
No response