SelectionChangedCommandParameter is evaluated before SelectedItem updates in .NET 11
まだ誰も着手していません。
評価
調査の方向性
添付されたサンプルを実行し、CollectionView で項目を選択して動作を再現します。SelectedItem バインディングの更新と SelectionChangedCommand の実行の順序を調べ、コマンドの実行時に SelectionChangedCommandParameter が更新された項目または ViewModel プロパティを受け取ることを確認します。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- C#
- スター
- 3.8k
- フォーク
- 401
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CommunityToolkit/dotnet のほかの issue
-
RelayCommand<T>.CanExecute(null) returns false for value types without a predicate対応中かも @apachezy が 85 日前に担当しました。 オープンbug :bug:
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
CommunityToolkit/dotnet#1206 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
CommunityToolkit/dotnet#648 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
CommunityToolkit/dotnet#1217 ·
-
bug :bug:
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
CommunityToolkit/dotnet#1215 ·
CommunityToolkit/dotnet の issue をすべて見る
似ている issue
-
Backend enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
dimitar-radenkov/Pointframe#271 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
qew21/Genshin-Subtitles#45 ·
-
bug priority: P2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
space-wizards/RobustToolbox#7158 ·
メンテナーはふだん 1 日以内に返信