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
22.06k stars 1.73k forks source link

[iOS] New CollectionViewHandler2 "swallows" attached properties #25195

Open DDHSchmidt opened 1 week ago

DDHSchmidt commented 1 week ago

Description

I'm using effects with attached properties on the DataTemplates for my CollectionView. When testing out the new CollectionViewHandler2 from .Net 9 I noticed that the attached properties couldn't be read within the Effect code anymore.

Reverting back to the normal CollectionViewHandler makes the attached properties work as expected.

I'm testing out effects as a workaround to the inability of CommunityToolkit's TouchBehavior, that's why the attached properties are referencing values via RelativeSource.

Not working with CollectionViewHandler2: Image

Working with "normal" CollectionViewHandler: Image

Steps to Reproduce

  1. Check out reproduction project
  2. Start on any iOS simulator/device
  3. Try clicking on any line within the CollectionView
  4. No messages appear
  5. Outcomment AddHandler-line in MauiProgram.cs
  6. Restart project
  7. Try clicking on any line within the CollectionView
  8. Messages will appear, signaling that the attached propertes worked.

Link to public reproduction project repository

https://github.com/DDHSchmidt/SourceBindingTest

Version with bug

9.0.0-rc.1.24453.9

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.91 SR9.1

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

Don't use new CollectionViewHandler2

Relevant log output

No response

Zhanglirong-Winnie commented 6 days ago

I can repro it at Windows platform on the latest 17.12.0 Preview 2.1(9.0.0-rc.1.24453.9), but it works fine on 8.0.91.