it does not have [ParameterAttribute] or [CascadingParameterAttribute] applied. 【C#/Blazor】
エラーメッセージ
Unhandled exception rendering component: Object of type
'BlazorApplicationxxx.Pages.Components.BmiChild'
has a property matching the name 'xxxx', but it does not have
[ParameterAttribute] or [CascadingParameterAttribute] applied.
問題のコード
親から子(Weight)を呼び出し
<BlazorApplication2.Pages.Components.BmiChild @bind-Weight="Weight" />
解決
[Parameter]
public double Weight
{
get => _Weight;
set
{
}
}
エラー通りにパラメータ属性を追加してあげて解決。
外部からプロパティにアクセスする場合は、プロパティにパラメータ属性を追加してあげる。