dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.86k stars 1.68k forks source link

CollectionView ItemsUpdatingScrollMode and deselect not working on macOS #21236

Open andrewstellman opened 4 months ago

andrewstellman commented 4 months ago

Description

The CollectionView control's ItemsUpdatingScrollMode does not seem to work on macOS (.NET 8.0.3). In this screenshot:

image

(screenshot from maui-collectionview-bug repo)

Clicking the button adds an item to the ObservableCollection that the CollectionView is bound to. The CollectionView has ItemsUpdatingScrollMode="KeepLastItemInView" set. I'm seeing two problems:

Problem 1: When running on Windows, when more items are added than fit in the view, it automatically scrolls to display the new item added. But when running on macOS, it does not automatically scroll, and seems to ignore the ItemsUpdatingScrollMode property.

Problem 2: When running on Windows, holding down control and clicking a selected item deselects it. On macOS, deselection does not seem to work when pressing option-click, control-click, or command-click.

Version info:

% dotnet workload list

Installed Workload Id      Manifest Version      Installation Source
--------------------------------------------------------------------
maui                       8.0.3/8.0.100         SDK 8.0.100        

Use `dotnet workload search` to find additional workloads to install.

Steps to Reproduce

  1. Add a CollectionView control to a page in a MAUI app and bind it to an ObservableCollection. Make sure it has the ItemsUpdatingScrollMode="KeepLastItemInView" and HeightRequest="125" properties.
  2. Run the app in macOS and add a bunch of items to the ObservableCollection so there .

Expected: The CollectionView scrolls to keep the last item in view. Actual: The CollectionView does not scroll.

  1. Click to select an item.
  2. Control-click, option-click, or command-click to deselect the selected item.

Expected: The item is deselected Actual: Nothing happens

Note that running in Windows returns the expected results, but running in macOS does not.

Link to public reproduction project repository

https://github.com/andrewstellman/maui-collectionview-bug/

Version with bug

8.0.3 GA

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

No response

Did you find any workaround?

Unfortunately, no.

Relevant log output

No response

ninachen03 commented 4 months ago

Verified this issue with Visual Studio for mac 17.6.10 (build428), can repro it on Maccatalyst platform with sample project. ScrollMode