Add the `partial` modifier to the generated property of the Relay Command
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- csharp
調査の方向性
まず Relay Command のソース生成エントリポイントを特定し、生成されたプロパティの処理を Observable Property ジェネレーターと比較します。生成された command プロパティが、対応する手書きの partial 宣言をサポートしていること、また XAML/App Model のソース生成シナリオでそれがリフレクションなしにコンパイル時に解決されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Overview
Add the partial modifier to the generated property of the Relay Command.
Now, app models like .NET MAUI have introduced a source generation feature that allows XAML to be translated into C#. However, the issue remains that source generators cannot interact with one another, such that only handwritten code is accessible.
Since the Observable Property is partial, it can be referenced in XAML without any issues. However, the Relay Command property is not partial, which prevents XAML source generation from inferring it. To resolve this, update the generated Relay Command property partial so that its declaration can be added in the handwritten code, while the MVVM toolkit handles the implementation.
API breakdown
Providing the source-generated code for reference. The generated property needs to be partial.
User code:
public partial IRelayCommand IncrementCommand { get; }
Generated:
private global::CommunityToolkit.Mvvm.Input.RelayCommand? incrementCommand;
// The request is make this IncrementCommand property partial
// so that the developer can add a declaration part in the source type.
public global::CommunityToolkit.Mvvm.Input.IRelayCommand IncrementCommand => incrementCommand ??= new global::CommunityToolkit.Mvvm.Input.RelayCommand(new global::System.Action(Increment));
Usage example
The IncrementCommand is now visible to the App Model source generator.
Previously, the evaluation occurred at runtime; now, to support AOT, it is resolved at compile time. To avoid reflection, the C# expression API is used, requiring at least the declaration/definition to be part of the handwritten code.
<Button Command="{Binding IncrementCommand}" />
Breaking change?
I'm not sure
Alternatives
Manually create the command property, losing all the toolkit's benefits.
Additional context
Multiple source generators at work.
Help us help you
No, just wanted to propose this
- 主要言語
- C#
- スター
- 3.8k
- フォーク
- 403
- 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 が 87 日前に担当しました。 オープン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
-
/api/oauth/introspect emits clientId and tokenType instead of RFC 7662's client_id and token_typeオープンbug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nightscout/nocturne#2317 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Position intent set on a simple order is dropped when it becomes a bracket, OCO or OTO order対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
alpacahq/alpaca-trade-api-csharp#903 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
joinrpg/joinrpg-net#5752 ·
メンテナーはふだん 1 日以内に返信
-
bug ux
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CodeForFire/lagebuch#714 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
dimitar-radenkov/Pointframe#294 ·
メンテナーはふだん 1 日以内に返信