-
Notifications
You must be signed in to change notification settings - Fork 372
Description
Describe the bug
When using CommunityToolkit-generated commands with CollectionView, the SelectionChangedCommandParameter is evaluated before the SelectedItem binding is updated in .NET 11.
This behavior differs from .NET 10, where the bound SelectedItem was already updated when the command executed.
As a result, commands that rely on ViewModel properties (for example, SelectedItem) receive null or stale values.
- The command executes before the SelectedItem binding is updated.
- SelectionChangedCommandParameter is null or contains the previous value.
- This breaks scenarios that rely on ViewModel-bound properties inside the command.
Regression
8.0.3
Steps to reproduce
Run the attached sample.
Tap/select an item in the CollectionView.
Observe that SelectionChangedCommand is invoked.
Inspect the value of SelectionChangedCommandParameter.
Expected behavior
SelectionChangedCommandParameter should receive the updated selected item (or the updated ViewModel property) when the command executes.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.0.4
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item