More issues with CollectionView IsEnabled, InputTransparent, Opacity via Styles and code behind #19771
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
area-xaml
XAML, CSS, Triggers, Behaviors
platform/android 🤖
platform/iOS 🍎
t/bug
Something isn't working
Milestone
Description
Based on my other bug #19768 (which may be related) I tried to make a workaround to change
InputTransparent
andOpacity
to "fake"IsEnabled=false
, I immediately ran into more issues.After making this test I found inconsistent results of how a
CollectionView
performs based on if I setIsEnabled
,InputTransparent
andOpacity
via xaml styles or via code.The linked example works like so:
Top left - Binds
IsEnabled="{Binding IsCollectionViewEnabled}"
Top right - Binds
IsEnabled="{Binding IsCollectionViewEnabled}"
but also has theAutoInputTransparent
style.Bottom left - In the backing code (not via binding) it sets
IsEnabled
to true/false depending on the button pushed.Bottom right - n the backing code (not via binding) it sets
Opacity
andInputTransparent
to 0.5/true and 1.0/false depending on the depending on the button pushed.In a perfect world if you hit the top row in every CollectionView you will see it select. If you hit the
IsEnabled=False
button then every CollectionView should go into a disabled like state. Clicking a different item in the CollectionView should not select it. Clicking theIsEnabled=True
button should now re-enable every CollectionView and allow you to select another item in the CollectionView.What actually happens is on clicking
IsEnabled=False
buttonIsEnabled
explicitly in the binding or in the code behind.Opacity
andInputTransparent
to fake being disabled).When re-enabling the CollectionViews with the
IsEnabled=True
buttonInputTransparent
didn't toggle back)Summary: Bottom right CollectionView is the only one that works as expected.
EDIT: If the following is added to the
MainPageModel.cs
changing the binding of the top right CollectionView to use
InputTransparent="{Binding IsInputTransparent}" Opacity="{Binding Opacity}"
and not useIsEnabled
orStyle
it will behave the same as the CollectionView in the bottom right.My take-away with that is that using a Style does not make it behave odd, however using IsEnabled + InputTransparent(style) + Opacity(style) is causing some bugs to happen.
EDIT 2:
Adding the following VisualStates to the top right collection view (removing any style, keeping IsEnabled binding)
it seems to perform the same as the bottom right CollectionView. To me this seems to indicate using a Style or using a VisualState is behaving differently even though the properties being set are identical. I don't know why these would differ, some race condition maybe?
Steps to Reproduce
Link to public reproduction project repository
https://github.com/beeradmoore/maui-issue-CollectionViewInputTransparentTest
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, macOS
Affected platform versions
iOS 17.2.1, macOS 14.2.1, Android 13
Did you find any workaround?
No
Relevant log output
No response
The text was updated successfully, but these errors were encountered: