maui icon indicating copy to clipboard operation
maui copied to clipboard

.NET MAUI - CollectionView SelectedItem binding functions on Windows but not Android platform

Open AndreduToit opened this issue 2 years ago • 8 comments

Description

CollectionView SelectedItem property binds to viewmodel property as expected on Windows platform. On Android platform clicking on an item of the CollectionView does not function as expected - the bound SelectedItem property is not activated. Please refer to the project 'MauiApp1' in Solution Folder 'CollectionView' of the solution at the following https://github.com/AndreduToit/NetMauiReproductions (reproduction sample code). Ensure ShellContent, ContentTemplate="{DataTemplate local:MainPage}".

Steps to Reproduce

  1. Please refer to the project 'MauiApp1' in Solution Folder 'CollectionView' of the solution at the following https://github.com/AndreduToit/NetMauiReproductions (reproduction sample code).
  2. Ensure ShellContent, ContentTemplate="{DataTemplate local:MainPage}".
  3. Run the project on Windows platform.
  4. Click the any item of the CollectionView - background color changes as expected.
  5. Run the same code on Android platform - background color DOES NOT change as expected.

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11.0

Did you find any workaround?

One workaround is to add a TapGestureRecognizer to the CollectionView.ItemTemplate. Add an Action to the viewmodel of the CollectionView item and point it back to an Action in the main page viewmodel. Workaround is demonstrated with MainPage2 of the reproduction sample code mentioned above. Just change ContentTemplate="{DataTemplate local:MainPage} to ContentTemplate="{DataTemplate local:MainPage2} in file AppShell.xaml.

Relevant log output

None

AndreduToit avatar Aug 18 '22 13:08 AndreduToit

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 18 '22 18:08 ghost

Related: https://github.com/dotnet/maui/pull/7689

PureWeen avatar Aug 18 '22 18:08 PureWeen

The impact of this issue is clear and it is not a very corner case scenario. It is simple code which works as expected on one platform but not another. In my opinion it is a fundamental bug which requires a complete refactoring of all my .NET Maui code to implement a workaround - so that I may have a functioning app whilst waiting for a bug fix. It causes me to question (once again) whether .NET Maui should have GA status. Please fix the bug soon, it is not a feature request so please don't wait for upvotes, etc.

AndreduToit avatar Aug 20 '22 06:08 AndreduToit

I ran into the same problem. I decided perhaps Maui is not mature enough especially with this obvious issue to make the switch so I'm going back to Xamarin forms for now.

jennablackwell avatar Sep 12 '22 02:09 jennablackwell

Verified this issue with Visual Studio Enterprise 17.6.0 Preview 7.0. Repro on Android platform with sample project. Windows works fine. NetMauiReproductions-master.zip Android: Android Windows: Windows

Zhanglirong-Winnie avatar May 23 '23 06:05 Zhanglirong-Winnie

It's crazy to me this still isn't prioritized or fixed after a year. This is table steaks

chris-oswald avatar Oct 05 '23 21:10 chris-oswald

Do you have due date?

AugPav avatar Oct 30 '23 18:10 AugPav

@AndreduToit and @chris-oswald are completly right, this bug is extremly annoying, since basically every application uses a collectionview. I would prioritize this bug way higher, since selecting an item from a list is basic functionallity of any ui framework.

larsduewel avatar Apr 12 '24 09:04 larsduewel